Skip to content

Commit bf46433

Browse files
committed
fix: Inline format args to satisfy clippy::uninlined_format_args
1 parent 9498cb2 commit bf46433

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

  • datafusion/spark/src/function/string

datafusion/spark/src/function/string/encode.rs

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ fn encode_dispatch(arr: &ArrayRef, charset: &str) -> Result<ArrayRef> {
168168
}
169169
Ok(Arc::new(builder.finish()))
170170
}
171-
dt => exec_err!("encode expects a string or binary argument, got {:?}", dt),
171+
dt => exec_err!("encode expects a string or binary argument, got {dt:?}"),
172172
}
173173
}
174174

@@ -204,7 +204,7 @@ fn extract_charset(charset_arg: &ColumnarValue) -> Result<String> {
204204
DataType::Utf8 => validate_constant_charset(&arr.as_string::<i32>()),
205205
DataType::LargeUtf8 => validate_constant_charset(&arr.as_string::<i64>()),
206206
DataType::Utf8View => validate_constant_charset(&arr.as_string_view()),
207-
dt => exec_err!("encode charset argument must be a string, got {:?}", dt),
207+
dt => exec_err!("encode charset argument must be a string, got {dt:?}"),
208208
}
209209
}
210210
}
@@ -294,7 +294,7 @@ mod tests {
294294
fn expect_binary_scalar(result: ColumnarValue) -> Vec<u8> {
295295
match result {
296296
ColumnarValue::Scalar(ScalarValue::Binary(Some(bytes))) => bytes,
297-
other => panic!("Expected Binary scalar, got {:?}", other),
297+
other => panic!("Expected Binary scalar, got {other:?}"),
298298
}
299299
}
300300

@@ -317,12 +317,16 @@ mod tests {
317317

318318
#[test]
319319
fn test_encode_iso_8859_1() {
320+
// "naïve" — U+00EF (ï) is 0xEF in ISO-8859-1
320321
let result = eval_encode_scalar(
321-
ScalarValue::Utf8(Some("caf\u{00E9}".into())),
322+
ScalarValue::Utf8(Some("na\u{00EF}ve".into())),
322323
"ISO-8859-1",
323324
)
324325
.unwrap();
325-
assert_eq!(expect_binary_scalar(result), vec![0x63, 0x61, 0x66, 0xE9]);
326+
assert_eq!(
327+
expect_binary_scalar(result),
328+
vec![0x6E, 0x61, 0xEF, 0x76, 0x65]
329+
);
326330
}
327331

328332
#[test]

0 commit comments

Comments
 (0)