diff --git a/src/config.rs b/src/config.rs index bb19fd6a..53214335 100644 --- a/src/config.rs +++ b/src/config.rs @@ -6,10 +6,10 @@ use std::ffi::CString; use std::os::raw::c_char; use std::ptr; -use strum::{EnumString, ToString}; +use strum::{Display, EnumString}; /// duckdb access mode, default is Automatic -#[derive(Debug, Eq, PartialEq, EnumString, ToString)] +#[derive(Debug, Eq, PartialEq, EnumString, Display)] pub enum AccessMode { /// Access mode of the database AUTOMATIC #[strum(to_string = "AUTOMATIC")] @@ -23,7 +23,7 @@ pub enum AccessMode { } /// duckdb default order, default is Asc -#[derive(Debug, Eq, PartialEq, EnumString, ToString)] +#[derive(Debug, Eq, PartialEq, EnumString, Display)] pub enum DefaultOrder { /// The order type, ASC #[strum(to_string = "ASC")] @@ -34,7 +34,7 @@ pub enum DefaultOrder { } /// duckdb default null order, default is nulls first -#[derive(Debug, Eq, PartialEq, EnumString, ToString)] +#[derive(Debug, Eq, PartialEq, EnumString, Display)] pub enum DefaultNullOrder { /// Null ordering, NullsFirst #[strum(to_string = "NULLS_FIRST")] @@ -46,6 +46,7 @@ pub enum DefaultNullOrder { /// duckdb configuration /// Refer to https://github.com/duckdb/duckdb/blob/master/src/main/config.cpp +#[derive(Default)] pub struct Config { config: Option, } @@ -123,12 +124,6 @@ impl Config { } } -impl Default for Config { - fn default() -> Config { - Config { config: None } - } -} - impl Drop for Config { fn drop(&mut self) { if self.config.is_some() { diff --git a/src/lib.rs b/src/lib.rs index e6ef70b7..281b537f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -418,7 +418,7 @@ impl Connection { .query(params)? .get_expected_row() .map_err(E::from) - .and_then(|r| f(r)) + .and_then(f) } /// Prepare a SQL statement for execution. diff --git a/src/row.rs b/src/row.rs index 63aa6815..e4f18dce 100644 --- a/src/row.rs +++ b/src/row.rs @@ -168,7 +168,7 @@ where self.rows .next() .transpose() - .map(|row_result| row_result.and_then(|row| (map)(row))) + .map(|row_result| row_result.and_then(map)) } } @@ -193,7 +193,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)) } } diff --git a/src/statement.rs b/src/statement.rs index b466af52..881c10e1 100644 --- a/src/statement.rs +++ b/src/statement.rs @@ -279,7 +279,7 @@ impl Statement<'_> { P: Params, F: FnOnce(&Row<'_>) -> Result, { - self.query(params)?.get_expected_row().and_then(|r| f(r)) + self.query(params)?.get_expected_row().and_then(f) } /// Return the row count