Skip to content

Commit f97653e

Browse files
committed
Fix clippy warnings
1 parent 35e6634 commit f97653e

File tree

4 files changed

+9
-14
lines changed

4 files changed

+9
-14
lines changed

src/config.rs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ use std::ffi::CString;
66
use std::os::raw::c_char;
77
use std::ptr;
88

9-
use strum::{EnumString, ToString};
9+
use strum::{Display, EnumString};
1010

1111
/// duckdb access mode, default is Automatic
12-
#[derive(Debug, Eq, PartialEq, EnumString, ToString)]
12+
#[derive(Debug, Eq, PartialEq, EnumString, Display)]
1313
pub enum AccessMode {
1414
/// Access mode of the database AUTOMATIC
1515
#[strum(to_string = "AUTOMATIC")]
@@ -23,7 +23,7 @@ pub enum AccessMode {
2323
}
2424

2525
/// duckdb default order, default is Asc
26-
#[derive(Debug, Eq, PartialEq, EnumString, ToString)]
26+
#[derive(Debug, Eq, PartialEq, EnumString, Display)]
2727
pub enum DefaultOrder {
2828
/// The order type, ASC
2929
#[strum(to_string = "ASC")]
@@ -34,7 +34,7 @@ pub enum DefaultOrder {
3434
}
3535

3636
/// duckdb default null order, default is nulls first
37-
#[derive(Debug, Eq, PartialEq, EnumString, ToString)]
37+
#[derive(Debug, Eq, PartialEq, EnumString, Display)]
3838
pub enum DefaultNullOrder {
3939
/// Null ordering, NullsFirst
4040
#[strum(to_string = "NULLS_FIRST")]
@@ -46,6 +46,7 @@ pub enum DefaultNullOrder {
4646

4747
/// duckdb configuration
4848
/// Refer to https://github.com/duckdb/duckdb/blob/master/src/main/config.cpp
49+
#[derive(Default)]
4950
pub struct Config {
5051
config: Option<ffi::duckdb_config>,
5152
}
@@ -123,12 +124,6 @@ impl Config {
123124
}
124125
}
125126

126-
impl Default for Config {
127-
fn default() -> Config {
128-
Config { config: None }
129-
}
130-
}
131-
132127
impl Drop for Config {
133128
fn drop(&mut self) {
134129
if self.config.is_some() {

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,7 @@ impl Connection {
418418
.query(params)?
419419
.get_expected_row()
420420
.map_err(E::from)
421-
.and_then(|r| f(r))
421+
.and_then(f)
422422
}
423423

424424
/// Prepare a SQL statement for execution.

src/row.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ where
168168
self.rows
169169
.next()
170170
.transpose()
171-
.map(|row_result| row_result.and_then(|row| (map)(row)))
171+
.map(|row_result| row_result.and_then(map))
172172
}
173173
}
174174

@@ -193,7 +193,7 @@ where
193193
self.rows
194194
.next()
195195
.transpose()
196-
.map(|row_result| row_result.map_err(E::from).and_then(|row| (map)(row)))
196+
.map(|row_result| row_result.map_err(E::from).and_then(map))
197197
}
198198
}
199199

src/statement.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ impl Statement<'_> {
279279
P: Params,
280280
F: FnOnce(&Row<'_>) -> Result<T>,
281281
{
282-
self.query(params)?.get_expected_row().and_then(|r| f(r))
282+
self.query(params)?.get_expected_row().and_then(f)
283283
}
284284

285285
/// Return the row count

0 commit comments

Comments
 (0)