diff --git a/src/backup.rs b/src/backup.rs index 0253ecb..f40ad79 100644 --- a/src/backup.rs +++ b/src/backup.rs @@ -167,7 +167,7 @@ pub struct Backup<'a, 'b> { b: *mut ffi::sqlite3_backup, } -impl<'a, 'b> Backup<'a, 'b> { +impl Backup<'_, '_> { /// Attempt to create a new handle that will allow backups from `from` to /// `to`. Note that `to` is a `&mut` - this is because SQLite forbids any /// API calls on the destination of a backup while the backup is taking @@ -177,7 +177,7 @@ impl<'a, 'b> Backup<'a, 'b> { /// /// Will return `Err` if the underlying `sqlite3_backup_init` call returns /// `NULL`. - pub fn new(from: &'a Connection, to: &'b mut Connection) -> Result> { + pub fn new<'a, 'b>(from: &'a Connection, to: &'b mut Connection) -> Result> { Backup::new_with_names(from, DatabaseName::Main, to, DatabaseName::Main) } @@ -190,7 +190,7 @@ impl<'a, 'b> Backup<'a, 'b> { /// /// Will return `Err` if the underlying `sqlite3_backup_init` call returns /// `NULL`. - pub fn new_with_names( + pub fn new_with_names<'a, 'b>( from: &'a Connection, from_name: DatabaseName<'_>, to: &'b mut Connection, @@ -294,7 +294,7 @@ impl<'a, 'b> Backup<'a, 'b> { } } -impl<'a, 'b> Drop for Backup<'a, 'b> { +impl Drop for Backup<'_, '_> { fn drop(&mut self) { unsafe { ffi::sqlite3_backup_finish(self.b) }; } diff --git a/src/blob.rs b/src/blob.rs index 9692d60..0f3d168 100644 --- a/src/blob.rs +++ b/src/blob.rs @@ -111,7 +111,7 @@ impl Connection { } } -impl<'conn> Blob<'conn> { +impl Blob<'_> { /// Move a BLOB handle to a new row. /// /// # Failure @@ -151,7 +151,7 @@ impl<'conn> Blob<'conn> { } } -impl<'conn> io::Read for Blob<'conn> { +impl io::Read for Blob<'_> { /// Read data from a BLOB incrementally. Will return Ok(0) if the end of /// the blob has been reached. /// @@ -175,7 +175,7 @@ impl<'conn> io::Read for Blob<'conn> { } } -impl<'conn> io::Write for Blob<'conn> { +impl io::Write for Blob<'_> { /// Write data into a BLOB incrementally. Will return `Ok(0)` if the end of /// the blob has been reached; consider using `Write::write_all(buf)` /// if you want to get an error if the entirety of the buffer cannot be @@ -208,7 +208,7 @@ impl<'conn> io::Write for Blob<'conn> { } } -impl<'conn> io::Seek for Blob<'conn> { +impl io::Seek for Blob<'_> { /// Seek to an offset, in bytes, in BLOB. fn seek(&mut self, pos: io::SeekFrom) -> io::Result { let pos = match pos { @@ -235,7 +235,7 @@ impl<'conn> io::Seek for Blob<'conn> { } #[allow(unused_must_use)] -impl<'conn> Drop for Blob<'conn> { +impl Drop for Blob<'_> { fn drop(&mut self) { self.close_(); } diff --git a/src/cache.rs b/src/cache.rs index da128a8..2c44641 100644 --- a/src/cache.rs +++ b/src/cache.rs @@ -79,7 +79,7 @@ impl<'conn> DerefMut for CachedStatement<'conn> { } } -impl<'conn> Drop for CachedStatement<'conn> { +impl Drop for CachedStatement<'_> { #[allow(unused_must_use)] fn drop(&mut self) { if let Some(stmt) = self.stmt.take() { @@ -88,8 +88,8 @@ impl<'conn> Drop for CachedStatement<'conn> { } } -impl<'conn> CachedStatement<'conn> { - fn new(stmt: Statement<'conn>, cache: &'conn StatementCache) -> CachedStatement<'conn> { +impl CachedStatement<'_> { + fn new<'conn>(stmt: Statement<'conn>, cache: &'conn StatementCache) -> CachedStatement<'conn> { CachedStatement { stmt: Some(stmt), cache, diff --git a/src/functions.rs b/src/functions.rs index a94b9a7..ddacb84 100644 --- a/src/functions.rs +++ b/src/functions.rs @@ -104,7 +104,7 @@ pub struct Context<'a> { args: &'a [*mut sqlite3_value], } -impl<'a> Context<'a> { +impl Context<'_> { /// Returns the number of arguments to the function. pub fn len(&self) -> usize { self.args.len() @@ -146,7 +146,7 @@ impl<'a> Context<'a> { /// # Failure /// /// Will panic if `idx` is greater than or equal to `self.len()`. - pub fn get_raw(&self, idx: usize) -> ValueRef<'a> { + pub fn get_raw(&self, idx: usize) -> ValueRef<'_> { let arg = self.args[idx]; unsafe { ValueRef::from_value(arg) } } diff --git a/src/lib.rs b/src/lib.rs index 9bb11a9..76ea093 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -264,7 +264,7 @@ pub enum DatabaseName<'a> { feature = "session", feature = "bundled" ))] -impl<'a> DatabaseName<'a> { +impl DatabaseName<'_> { fn to_cstring(&self) -> Result { use self::DatabaseName::{Attached, Main, Temp}; match *self { diff --git a/src/load_extension_guard.rs b/src/load_extension_guard.rs index 096e6ac..ee3dda3 100644 --- a/src/load_extension_guard.rs +++ b/src/load_extension_guard.rs @@ -17,7 +17,7 @@ pub struct LoadExtensionGuard<'conn> { conn: &'conn Connection, } -impl<'conn> LoadExtensionGuard<'conn> { +impl LoadExtensionGuard<'_> { /// Attempt to enable loading extensions. Loading extensions will be /// disabled when this guard goes out of scope. Cannot be meaningfully /// nested. @@ -28,7 +28,7 @@ impl<'conn> LoadExtensionGuard<'conn> { } #[allow(unused_must_use)] -impl<'conn> Drop for LoadExtensionGuard<'conn> { +impl Drop for LoadExtensionGuard<'_> { fn drop(&mut self) { self.conn.load_extension_disable(); } diff --git a/src/row.rs b/src/row.rs index fca2509..4431a3d 100644 --- a/src/row.rs +++ b/src/row.rs @@ -59,7 +59,7 @@ impl<'stmt> Rows<'stmt> { } } -impl<'stmt> Drop for Rows<'stmt> { +impl Drop for Rows<'_> { fn drop(&mut self) { self.reset(); } @@ -80,7 +80,7 @@ where } } -impl<'conn, T, F> Iterator for MappedRows<'conn, F> +impl Iterator for MappedRows<'_, F> where F: FnMut(&Row<'_, '_>) -> T, { @@ -110,7 +110,7 @@ where } } -impl<'stmt, T, E, F> Iterator for AndThenRows<'stmt, F> +impl Iterator for AndThenRows<'_, F> where E: convert::From, F: FnMut(&Row<'_, '_>) -> result::Result, @@ -245,7 +245,7 @@ impl RowIndex for usize { } } -impl<'a> RowIndex for &'a str { +impl RowIndex for &'_ str { #[inline] fn idx(&self, stmt: &Statement<'_>) -> Result { stmt.column_index(*self) diff --git a/src/session.rs b/src/session.rs index 70a9f53..ac6e9f9 100644 --- a/src/session.rs +++ b/src/session.rs @@ -28,14 +28,17 @@ pub struct Session<'conn> { filter: Option bool>>, } -impl<'conn> Session<'conn> { +impl Session<'_> { /// Create a new session object - pub fn new(db: &'conn Connection) -> Result> { + pub fn new<'conn>(db: &'conn Connection) -> Result> { Session::new_with_name(db, DatabaseName::Main) } /// Create a new session object - pub fn new_with_name(db: &'conn Connection, name: DatabaseName<'_>) -> Result> { + pub fn new_with_name<'conn>( + db: &'conn Connection, + name: DatabaseName<'_>, + ) -> Result> { let name = name.to_cstring()?; let db = db.db.borrow_mut().db; @@ -196,7 +199,7 @@ impl<'conn> Session<'conn> { } } -impl<'conn> Drop for Session<'conn> { +impl Drop for Session<'_> { fn drop(&mut self) { if self.filter.is_some() { self.table_filter(None:: bool>); @@ -292,7 +295,7 @@ pub struct ChangesetIter<'changeset> { item: Option, } -impl<'changeset> ChangesetIter<'changeset> { +impl ChangesetIter<'_> { /// Create an iterator on `input` pub fn start_strm<'input>(input: &'input mut dyn Read) -> Result> { let input_ref = &input; @@ -312,7 +315,7 @@ impl<'changeset> ChangesetIter<'changeset> { } } -impl<'changeset> FallibleStreamingIterator for ChangesetIter<'changeset> { +impl FallibleStreamingIterator for ChangesetIter<'_> { type Error = crate::error::Error; type Item = ChangesetItem; @@ -343,7 +346,7 @@ pub struct Operation<'item> { indirect: bool, } -impl<'item> Operation<'item> { +impl Operation<'_> { pub fn table_name(&self) -> &str { self.table_name } @@ -361,7 +364,7 @@ impl<'item> Operation<'item> { } } -impl<'changeset> Drop for ChangesetIter<'changeset> { +impl Drop for ChangesetIter<'_> { fn drop(&mut self) { unsafe { ffi::sqlite3changeset_finalize(self.it); diff --git a/src/statement.rs b/src/statement.rs index 562817c..a32aa28 100644 --- a/src/statement.rs +++ b/src/statement.rs @@ -21,7 +21,7 @@ pub struct Statement<'conn> { stmt: RawStatement, } -impl<'conn> Statement<'conn> { +impl Statement<'_> { /// Get all the column names in the result set of the prepared statement. pub fn column_names(&self) -> Vec<&str> { let n = self.column_count(); @@ -234,7 +234,7 @@ impl<'conn> Statement<'conn> { /// # Failure /// /// Will return `Err` if binding parameters fails. - pub fn query_named<'a>(&'a mut self, params: &[(&str, &dyn ToSql)]) -> Result> { + pub fn query_named(&mut self, params: &[(&str, &dyn ToSql)]) -> Result> { self.check_readonly()?; self.bind_parameters_named(params)?; Ok(Rows::new(self)) @@ -300,11 +300,11 @@ impl<'conn> Statement<'conn> { /// ## Failure /// /// Will return `Err` if binding parameters fails. - pub fn query_map_named<'a, T, F>( - &'a mut self, + pub fn query_map_named( + &mut self, params: &[(&str, &dyn ToSql)], f: F, - ) -> Result> + ) -> Result> where F: FnMut(&Row<'_, '_>) -> T, { @@ -368,11 +368,11 @@ impl<'conn> Statement<'conn> { /// ## Failure /// /// Will return `Err` if binding parameters fails. - pub fn query_and_then_named<'a, T, E, F>( - &'a mut self, + pub fn query_and_then_named( + &mut self, params: &[(&str, &dyn ToSql)], f: F, - ) -> Result> + ) -> Result> where E: convert::From, F: FnMut(&Row<'_, '_>) -> result::Result, @@ -604,7 +604,7 @@ impl<'conn> Statement<'conn> { } } -impl<'conn> Into for Statement<'conn> { +impl Into for Statement<'_> { fn into(mut self) -> RawStatement { let mut stmt = RawStatement::new(ptr::null_mut()); mem::swap(&mut stmt, &mut self.stmt); @@ -612,7 +612,7 @@ impl<'conn> Into for Statement<'conn> { } } -impl<'conn> fmt::Debug for Statement<'conn> { +impl fmt::Debug for Statement<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let sql = str::from_utf8(self.stmt.sql().to_bytes()); f.debug_struct("Statement") @@ -623,14 +623,14 @@ impl<'conn> fmt::Debug for Statement<'conn> { } } -impl<'conn> Drop for Statement<'conn> { +impl Drop for Statement<'_> { #[allow(unused_must_use)] fn drop(&mut self) { self.finalize_(); } } -impl<'conn> Statement<'conn> { +impl Statement<'_> { pub(crate) fn new(conn: &Connection, stmt: RawStatement) -> Statement<'_> { Statement { conn, stmt } } diff --git a/src/transaction.rs b/src/transaction.rs index 4ee1e82..3c77a1c 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -87,7 +87,7 @@ pub struct Savepoint<'conn> { committed: bool, } -impl<'conn> Transaction<'conn> { +impl Transaction<'_> { /// Begin a new transaction. Cannot be nested; see `savepoint` for nested /// transactions. /// Even though we don't mutate the connection, we take a `&mut Connection` @@ -195,7 +195,7 @@ impl<'conn> Transaction<'conn> { } } -impl<'conn> Deref for Transaction<'conn> { +impl Deref for Transaction<'_> { type Target = Connection; fn deref(&self) -> &Connection { @@ -204,13 +204,13 @@ impl<'conn> Deref for Transaction<'conn> { } #[allow(unused_must_use)] -impl<'conn> Drop for Transaction<'conn> { +impl Drop for Transaction<'_> { fn drop(&mut self) { self.finish_(); } } -impl<'conn> Savepoint<'conn> { +impl Savepoint<'_> { fn with_depth_and_name>( conn: &Connection, depth: u32, @@ -308,7 +308,7 @@ impl<'conn> Savepoint<'conn> { } } -impl<'conn> Deref for Savepoint<'conn> { +impl Deref for Savepoint<'_> { type Target = Connection; fn deref(&self) -> &Connection { @@ -317,7 +317,7 @@ impl<'conn> Deref for Savepoint<'conn> { } #[allow(unused_must_use)] -impl<'conn> Drop for Savepoint<'conn> { +impl Drop for Savepoint<'_> { fn drop(&mut self) { self.finish_(); } diff --git a/src/types/to_sql.rs b/src/types/to_sql.rs index c2ae0cd..0d9a21d 100644 --- a/src/types/to_sql.rs +++ b/src/types/to_sql.rs @@ -40,7 +40,7 @@ where // be converted into Values. macro_rules! from_value( ($t:ty) => ( - impl<'a> From<$t> for ToSqlOutput<'a> { + impl From<$t> for ToSqlOutput<'_> { fn from(t: $t) -> Self { ToSqlOutput::Owned(t.into())} } ) @@ -65,7 +65,7 @@ from_value!(Vec); #[cfg(feature = "i128_blob")] from_value!(i128); -impl<'a> ToSql for ToSqlOutput<'a> { +impl ToSql for ToSqlOutput<'_> { fn to_sql(&self) -> Result> { Ok(match *self { ToSqlOutput::Borrowed(v) => ToSqlOutput::Borrowed(v), @@ -121,7 +121,7 @@ to_sql_self!(f64); #[cfg(feature = "i128_blob")] to_sql_self!(i128); -impl<'a, T: ?Sized> ToSql for &'a T +impl ToSql for &'_ T where T: ToSql, { @@ -169,7 +169,7 @@ impl ToSql for Option { } } -impl<'a> ToSql for Cow<'a, str> { +impl ToSql for Cow<'_, str> { fn to_sql(&self) -> Result> { Ok(ToSqlOutput::from(self.as_ref())) } diff --git a/src/types/value_ref.rs b/src/types/value_ref.rs index a701256..bca8df8 100644 --- a/src/types/value_ref.rs +++ b/src/types/value_ref.rs @@ -19,7 +19,7 @@ pub enum ValueRef<'a> { Blob(&'a [u8]), } -impl<'a> ValueRef<'a> { +impl ValueRef<'_> { pub fn data_type(&self) -> Type { match *self { ValueRef::Null => Type::Null, @@ -69,7 +69,7 @@ impl<'a> ValueRef<'a> { } } -impl<'a> From> for Value { +impl From> for Value { fn from(borrowed: ValueRef<'_>) -> Value { match borrowed { ValueRef::Null => Value::Null, diff --git a/src/vtab/mod.rs b/src/vtab/mod.rs index e58616f..cf3bee5 100644 --- a/src/vtab/mod.rs +++ b/src/vtab/mod.rs @@ -337,7 +337,7 @@ impl<'a> Iterator for IndexConstraintIter<'a> { /// WHERE clause constraint pub struct IndexConstraint<'a>(&'a ffi::sqlite3_index_constraint); -impl<'a> IndexConstraint<'a> { +impl IndexConstraint<'_> { /// Column constrained. -1 for ROWID pub fn column(&self) -> c_int { self.0.iColumn @@ -357,7 +357,7 @@ impl<'a> IndexConstraint<'a> { /// Information about what parameters to pass to `VTabCursor.filter`. pub struct IndexConstraintUsage<'a>(&'a mut ffi::sqlite3_index_constraint_usage); -impl<'a> IndexConstraintUsage<'a> { +impl IndexConstraintUsage<'_> { /// if `argv_index` > 0, constraint is part of argv to `VTabCursor.filter` pub fn set_argv_index(&mut self, argv_index: c_int) { self.0.argvIndex = argv_index; @@ -388,7 +388,7 @@ impl<'a> Iterator for OrderByIter<'a> { /// A column of the ORDER BY clause. pub struct OrderBy<'a>(&'a ffi::sqlite3_index_info_sqlite3_index_orderby); -impl<'a> OrderBy<'a> { +impl OrderBy<'_> { /// Column number pub fn column(&self) -> c_int { self.0.iColumn @@ -453,7 +453,7 @@ pub struct Values<'a> { args: &'a [*mut ffi::sqlite3_value], } -impl<'a> Values<'a> { +impl Values<'_> { pub fn len(&self) -> usize { self.args.len() }