From f7c1a8e7b82387dd2b59f989982818dc20219f13 Mon Sep 17 00:00:00 2001 From: gwenn Date: Wed, 19 Jul 2017 21:26:39 +0200 Subject: [PATCH] Fix some clippy warnings --- src/lib.rs | 8 ++++---- src/statement.rs | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 32740b3..c6d6684 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -142,7 +142,7 @@ fn str_to_cstring(s: &str) -> Result { } fn path_to_cstring(p: &Path) -> Result { - let s = try!(p.to_str().ok_or(Error::InvalidPath(p.to_owned()))); + let s = try!(p.to_str().ok_or_else(|| Error::InvalidPath(p.to_owned()))); str_to_cstring(s) } @@ -737,9 +737,9 @@ impl InnerConnection { // Replicate the check for sane open flags from SQLite, because the check in SQLite itself // wasn't added until version 3.7.3. - debug_assert!(1 << SQLITE_OPEN_READ_ONLY.bits == 0x02); - debug_assert!(1 << SQLITE_OPEN_READ_WRITE.bits == 0x04); - debug_assert!(1 << (SQLITE_OPEN_READ_WRITE | SQLITE_OPEN_CREATE).bits == 0x40); + debug_assert_eq!(1 << SQLITE_OPEN_READ_ONLY.bits, 0x02); + debug_assert_eq!(1 << SQLITE_OPEN_READ_WRITE.bits, 0x04); + debug_assert_eq!(1 << (SQLITE_OPEN_READ_WRITE | SQLITE_OPEN_CREATE).bits, 0x40); if (1 << (flags.bits & 0x7)) & 0x46 == 0 { return Err(Error::SqliteFailure(ffi::Error::new(ffi::SQLITE_MISUSE), None)); } diff --git a/src/statement.rs b/src/statement.rs index 8885ec1..2674c32 100644 --- a/src/statement.rs +++ b/src/statement.rs @@ -368,7 +368,7 @@ impl<'conn> Statement<'conn> { } fn bind_parameters(&mut self, params: &[&ToSql]) -> Result<()> { - assert!(params.len() as c_int == self.stmt.bind_parameter_count(), + assert_eq!(params.len() as c_int, self.stmt.bind_parameter_count(), "incorrect number of parameters to query(): expected {}, got {}", self.stmt.bind_parameter_count(), params.len());