Skip to content

Commit d69a5b6

Browse files
mlafeldtMaxxen
authored andcommitted
Fix clippy::uninlined_format_args warnings
1 parent 511f3e4 commit d69a5b6

File tree

8 files changed

+18
-19
lines changed

8 files changed

+18
-19
lines changed

crates/duckdb-loadable-macros/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,10 @@ pub fn duckdb_entrypoint_c_api(attr: TokenStream, item: TokenStream) -> TokenStr
5858

5959
match ast {
6060
Item::Fn(func) => {
61-
let c_entrypoint = Ident::new(format!("{}_init_c_api", extension_name).as_str(), Span::call_site());
61+
let c_entrypoint = Ident::new(format!("{extension_name}_init_c_api").as_str(), Span::call_site());
6262
let prefixed_original_function = func.sig.ident.clone();
6363
let c_entrypoint_internal = Ident::new(
64-
format!("{}_init_c_api_internal", extension_name).as_str(),
64+
format!("{extension_name}_init_c_api_internal").as_str(),
6565
Span::call_site(),
6666
);
6767

@@ -132,7 +132,7 @@ pub fn duckdb_entrypoint(_attr: TokenStream, item: TokenStream) -> TokenStream {
132132
);
133133

134134
let original_funcname = func.sig.ident.to_string();
135-
func.sig.ident = Ident::new(format!("_{}", original_funcname).as_str(), func.sig.ident.span());
135+
func.sig.ident = Ident::new(format!("_{original_funcname}").as_str(), func.sig.ident.span());
136136

137137
let prefixed_original_function = func.sig.ident.clone();
138138

crates/duckdb/src/appender/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ mod test {
303303
Err(crate::Error::DuckDBFailure(.., Some(msg))) => {
304304
assert_eq!(msg, "Call to EndRow before all columns have been appended to!")
305305
}
306-
Err(err) => panic!("unexpected error: {:?}", err),
306+
Err(err) => panic!("unexpected error: {err:?}"),
307307
Ok(_) => panic!("expected an error but got Ok"),
308308
}
309309
Ok(())

crates/duckdb/src/raw_statement.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ impl RawStatement {
183183
// Therefore, we return None when encountering this error.
184184
match err {
185185
polars::error::PolarsError::ComputeError(_) => return None,
186-
_ => panic!("Failed to import arrow2 Array from C: {}", err),
186+
_ => panic!("Failed to import arrow2 Array from C: {err}"),
187187
}
188188
}
189189

crates/duckdb/src/test_all_types.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ fn test_with_database(database: &Connection) -> crate::Result<()> {
3030
"SELECT * EXCLUDE ({}) FROM test_all_types()",
3131
excluded
3232
.iter()
33-
.map(|s| format!("'{}'", s))
33+
.map(|s| format!("'{s}'"))
3434
.collect::<Vec<String>>()
3535
.join(",")
3636
))?;

crates/duckdb/src/vscalar/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ mod test {
182182
) -> Result<(), Box<dyn std::error::Error>> {
183183
let mut msg = input.flat_vector(0).as_slice_with_len::<duckdb_string_t>(input.len())[0];
184184
let string = DuckString::new(&mut msg).as_str();
185-
Err(format!("Error: {}", string).into())
185+
Err(format!("Error: {string}").into())
186186
}
187187

188188
fn signatures() -> Vec<ScalarFunctionSignature> {

crates/duckdb/src/vtab/arrow.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,7 @@ pub fn to_duckdb_type_id(data_type: &DataType) -> Result<LogicalTypeId, Box<dyn
161161
DataType::Decimal256(_, _) => Double,
162162
DataType::Map(_, _) => Map,
163163
_ => {
164-
return Err(format!("Unsupported data type: {:?}", data_type).into());
164+
return Err(format!("Unsupported data type: {data_type:?}").into());
165165
}
166166
};
167167
Ok(type_id)
@@ -636,8 +636,7 @@ pub fn write_arrow_array_to_vector(
636636
}
637637
dt => {
638638
return Err(format!(
639-
"column with data_type {} is not supported yet, please file an issue https://github.com/duckdb/duckdb-rs",
640-
dt
639+
"column with data_type {dt} is not supported yet, please file an issue https://github.com/duckdb/duckdb-rs"
641640
)
642641
.into());
643642
}
@@ -858,7 +857,7 @@ fn decimal_array_to_vector(array: &Decimal128Array, out: &mut FlatVector, width:
858857
}
859858
}
860859
// This should never happen, arrow only supports 1-38 decimal digits
861-
_ => panic!("Invalid decimal width: {}", width),
860+
_ => panic!("Invalid decimal width: {width}"),
862861
}
863862

864863
// Set nulls
@@ -1995,7 +1994,7 @@ mod test {
19951994
check_map_array_roundtrip(map_array)?;
19961995

19971996
// Test 2 - large MapArray of 4000 elements to test buffers capacity adjustment
1998-
let keys: Vec<String> = (0..4000).map(|i| format!("key-{}", i)).collect();
1997+
let keys: Vec<String> = (0..4000).map(|i| format!("key-{i}")).collect();
19991998
let values_data = UInt32Array::from(
20001999
(0..4000)
20012000
.map(|i| if i % 5 == 0 { None } else { Some(i as u32) })

crates/duckdb/src/vtab/excel.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ impl VTab for ExcelVTab {
3535
let mut workbook = open_workbook_auto(path)?;
3636
let range = workbook
3737
.worksheet_range(&sheet)
38-
.unwrap_or_else(|| panic!("Can't find sheet: {} ?", sheet))?;
38+
.unwrap_or_else(|| panic!("Can't find sheet: {sheet} ?"))?;
3939
let _column_count = range.get_size().1;
4040
let mut rows = range.rows();
4141
let header = rows.next().unwrap();
@@ -62,39 +62,39 @@ impl VTab for ExcelVTab {
6262
bind.add_result_column(
6363
header[idx]
6464
.get_string()
65-
.unwrap_or_else(|| panic!("idx {} header empty?", idx)),
65+
.unwrap_or_else(|| panic!("idx {idx} header empty?")),
6666
LogicalTypeHandle::from(LogicalTypeId::Varchar),
6767
);
6868
}
6969
DataType::Float(_) => {
7070
bind.add_result_column(
7171
header[idx]
7272
.get_string()
73-
.unwrap_or_else(|| panic!("idx {} header empty?", idx)),
73+
.unwrap_or_else(|| panic!("idx {idx} header empty?")),
7474
LogicalTypeHandle::from(LogicalTypeId::Double),
7575
);
7676
}
7777
DataType::Int(_) => {
7878
bind.add_result_column(
7979
header[idx]
8080
.get_string()
81-
.unwrap_or_else(|| panic!("idx {} header empty?", idx)),
81+
.unwrap_or_else(|| panic!("idx {idx} header empty?")),
8282
LogicalTypeHandle::from(LogicalTypeId::Bigint),
8383
);
8484
}
8585
DataType::Bool(_) => {
8686
bind.add_result_column(
8787
header[idx]
8888
.get_string()
89-
.unwrap_or_else(|| panic!("idx {} header empty?", idx)),
89+
.unwrap_or_else(|| panic!("idx {idx} header empty?")),
9090
LogicalTypeHandle::from(LogicalTypeId::Boolean),
9191
);
9292
}
9393
DataType::DateTime(_) => {
9494
bind.add_result_column(
9595
header[idx]
9696
.get_string()
97-
.unwrap_or_else(|| panic!("idx {} header empty?", idx)),
97+
.unwrap_or_else(|| panic!("idx {idx} header empty?")),
9898
LogicalTypeHandle::from(LogicalTypeId::Date),
9999
);
100100
}

crates/duckdb/src/vtab/function.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ impl BindInfo {
7474
unsafe {
7575
let ptr = duckdb_bind_get_parameter(self.ptr, param_index);
7676
if ptr.is_null() {
77-
panic!("{} is out of range for function definition", param_index);
77+
panic!("{param_index} is out of range for function definition");
7878
} else {
7979
Value::from(ptr)
8080
}

0 commit comments

Comments
 (0)