diff --git a/src/backup.rs b/src/backup.rs index 72d54e5..6cb586b 100644 --- a/src/backup.rs +++ b/src/backup.rs @@ -203,8 +203,8 @@ impl Backup<'_, '_> { to: &'b mut Connection, to_name: DatabaseName<'_>, ) -> Result> { - let to_name = to_name.to_cstring()?; - let from_name = from_name.to_cstring()?; + let to_name = to_name.as_cstring()?; + let from_name = from_name.as_cstring()?; let to_db = to.db.borrow_mut().db; diff --git a/src/blob/mod.rs b/src/blob/mod.rs index 202f65d..cd9ad31 100644 --- a/src/blob/mod.rs +++ b/src/blob/mod.rs @@ -225,7 +225,7 @@ impl Connection { ) -> Result> { let mut c = self.db.borrow_mut(); let mut blob = ptr::null_mut(); - let db = db.to_cstring()?; + let db = db.as_cstring()?; let table = super::str_to_cstring(table)?; let column = super::str_to_cstring(column)?; let rc = unsafe { diff --git a/src/busy.rs b/src/busy.rs index 447610e..e51fb08 100644 --- a/src/busy.rs +++ b/src/busy.rs @@ -169,7 +169,7 @@ mod test { let _ = db2 .query_row("PRAGMA schema_version", [], |row| row.get::<_, i32>(0)) .expect("unexpected error"); - assert_eq!(CALLED.load(Ordering::Relaxed), true); + assert!(CALLED.load(Ordering::Relaxed)); child.join().unwrap(); } diff --git a/src/functions.rs b/src/functions.rs index ce908d5..b021000 100644 --- a/src/functions.rs +++ b/src/functions.rs @@ -883,7 +883,7 @@ mod test { let result: Result = db.query_row("SELECT regexp('l.s[aeiouy]', 'lisa')", [], |r| r.get(0)); - assert_eq!(true, result?); + assert!(result?); let result: Result = db.query_row( "SELECT COUNT(*) FROM foo WHERE regexp('l.s[aeiouy]', x) == 1", diff --git a/src/lib.rs b/src/lib.rs index 926cad3..f588b39 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -310,7 +310,7 @@ pub const TEMP_DB: DatabaseName<'static> = DatabaseName::Temp; ))] impl DatabaseName<'_> { #[inline] - fn to_cstring(&self) -> Result { + fn as_cstring(&self) -> Result { use self::DatabaseName::{Attached, Main, Temp}; match *self { Main => str_to_cstring("main"), @@ -1016,7 +1016,7 @@ impl InterruptHandle { #[cfg(feature = "modern_sqlite")] // 3.7.10 unsafe fn db_filename(db: *mut ffi::sqlite3) -> Option { - let db_name = DatabaseName::Main.to_cstring().unwrap(); + let db_name = DatabaseName::Main.as_cstring().unwrap(); let db_filename = ffi::sqlite3_db_filename(db, db_name.as_ptr()); if db_filename.is_null() { None diff --git a/src/session.rs b/src/session.rs index 4e4c354..b40e4b0 100644 --- a/src/session.rs +++ b/src/session.rs @@ -40,7 +40,7 @@ impl Session<'_> { db: &'conn Connection, name: DatabaseName<'_>, ) -> Result> { - let name = name.to_cstring()?; + let name = name.as_cstring()?; let db = db.db.borrow_mut().db; @@ -161,7 +161,7 @@ impl Session<'_> { /// Load the difference between tables. pub fn diff(&mut self, from: DatabaseName<'_>, table: &str) -> Result<()> { - let from = from.to_cstring()?; + let from = from.as_cstring()?; let table = str_to_cstring(table)?; let table = table.as_ptr(); unsafe {