Fix clippy warnings

This commit is contained in:
gwenn
2021-10-01 20:09:48 +02:00
parent e2af87f747
commit ce90b519bb
6 changed files with 22 additions and 23 deletions

View File

@@ -430,15 +430,13 @@ fn ensure_safe_sqlite_threading_mode() -> Result<()> {
}
unsafe {
if ffi::sqlite3_config(ffi::SQLITE_CONFIG_MULTITHREAD) != ffi::SQLITE_OK || ffi::sqlite3_initialize() != ffi::SQLITE_OK {
panic!(
assert!(ffi::sqlite3_config(ffi::SQLITE_CONFIG_MULTITHREAD) == ffi::SQLITE_OK && ffi::sqlite3_initialize() == ffi::SQLITE_OK,
"Could not ensure safe initialization of SQLite.\n\
To fix this, either:\n\
* Upgrade SQLite to at least version 3.7.0\n\
* Ensure that SQLite has been initialized in Multi-thread or Serialized mode and call\n\
rusqlite::bypass_sqlite_initialization() prior to your first connection attempt."
);
}
}
});
Ok(())

View File

@@ -679,7 +679,7 @@ impl Connection {
stmt.check_no_tail()?;
let mut rows = stmt.query(params)?;
rows.get_expected_row().map_err(E::from).and_then(|r| f(r))
rows.get_expected_row().map_err(E::from).and_then(f)
}
/// Prepare a SQL statement for execution.
@@ -1346,9 +1346,11 @@ mod test {
fn test_execute_select() {
let db = checked_memory_handle();
let err = db.execute("SELECT 1 WHERE 1 < ?", [1i32]).unwrap_err();
if err != Error::ExecuteReturnedResults {
panic!("Unexpected error: {}", err);
}
assert!(
err == Error::ExecuteReturnedResults,
"Unexpected error: {}",
err
);
}
#[test]

View File

@@ -156,7 +156,7 @@ where
self.rows
.next()
.transpose()
.map(|row_result| row_result.and_then(|row| (map)(row)))
.map(|row_result| row_result.and_then(map))
}
}
@@ -181,7 +181,7 @@ where
self.rows
.next()
.transpose()
.map(|row_result| row_result.map_err(E::from).and_then(|row| (map)(row)))
.map(|row_result| row_result.map_err(E::from).and_then(map))
}
}

View File

@@ -453,7 +453,7 @@ impl Statement<'_> {
{
let mut rows = self.query(params)?;
rows.get_expected_row().and_then(|r| f(r))
rows.get_expected_row().and_then(f)
}
/// Convenience method to execute a query with named parameter(s) that is

View File

@@ -431,7 +431,7 @@ impl<'a> Iterator for IndexConstraintIter<'a> {
#[inline]
fn next(&mut self) -> Option<IndexConstraint<'a>> {
self.iter.next().map(|raw| IndexConstraint(raw))
self.iter.next().map(IndexConstraint)
}
#[inline]
@@ -492,7 +492,7 @@ impl<'a> Iterator for OrderByIter<'a> {
#[inline]
fn next(&mut self) -> Option<OrderBy<'a>> {
self.iter.next().map(|raw| OrderBy(raw))
self.iter.next().map(OrderBy)
}
#[inline]