Fix some clippy warnings

This commit is contained in:
gwenn 2017-07-19 21:26:39 +02:00
parent d5bd7d9601
commit f7c1a8e7b8
2 changed files with 5 additions and 5 deletions

View File

@ -142,7 +142,7 @@ fn str_to_cstring(s: &str) -> Result<CString> {
} }
fn path_to_cstring(p: &Path) -> Result<CString> { fn path_to_cstring(p: &Path) -> Result<CString> {
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) 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 // Replicate the check for sane open flags from SQLite, because the check in SQLite itself
// wasn't added until version 3.7.3. // wasn't added until version 3.7.3.
debug_assert!(1 << SQLITE_OPEN_READ_ONLY.bits == 0x02); debug_assert_eq!(1 << SQLITE_OPEN_READ_ONLY.bits, 0x02);
debug_assert!(1 << SQLITE_OPEN_READ_WRITE.bits == 0x04); debug_assert_eq!(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_WRITE | SQLITE_OPEN_CREATE).bits, 0x40);
if (1 << (flags.bits & 0x7)) & 0x46 == 0 { if (1 << (flags.bits & 0x7)) & 0x46 == 0 {
return Err(Error::SqliteFailure(ffi::Error::new(ffi::SQLITE_MISUSE), None)); return Err(Error::SqliteFailure(ffi::Error::new(ffi::SQLITE_MISUSE), None));
} }

View File

@ -368,7 +368,7 @@ impl<'conn> Statement<'conn> {
} }
fn bind_parameters(&mut self, params: &[&ToSql]) -> Result<()> { 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 {}", "incorrect number of parameters to query(): expected {}, got {}",
self.stmt.bind_parameter_count(), self.stmt.bind_parameter_count(),
params.len()); params.len());