Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
tachiniererin committed Jan 2, 2022
1 parent 35e6634 commit f97653e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 14 deletions.
15 changes: 5 additions & 10 deletions src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand All @@ -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")]
Expand All @@ -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")]
Expand All @@ -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<ffi::duckdb_config>,
}
Expand Down Expand Up @@ -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() {
Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions src/row.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
}
}

Expand All @@ -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))
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/statement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ impl Statement<'_> {
P: Params,
F: FnOnce(&Row<'_>) -> Result<T>,
{
self.query(params)?.get_expected_row().and_then(|r| f(r))
self.query(params)?.get_expected_row().and_then(f)
}

/// Return the row count
Expand Down

0 comments on commit f97653e

Please sign in to comment.