Skip to content

Commit 7e56c44

Browse files
authored
fix: clippy (#254)
1 parent c48caa3 commit 7e56c44

File tree

13 files changed

+74
-127
lines changed

13 files changed

+74
-127
lines changed

examples/inserter.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ async fn main() -> Result<()> {
151151

152152
// Prints 10 batches with 100 rows in each.
153153
for (insertion_time, count) in fetch_batches(&client).await? {
154-
println!("{}: {} rows", insertion_time, count);
154+
println!("{insertion_time}: {count} rows");
155155
}
156156

157157
client
@@ -166,7 +166,7 @@ async fn main() -> Result<()> {
166166

167167
// Prints batches every 100±10ms.
168168
for (insertion_time, count) in fetch_batches(&client).await? {
169-
println!("{}: {} rows", insertion_time, count);
169+
println!("{insertion_time}: {count} rows");
170170
}
171171

172172
Ok(())

examples/stream_arbitrary_format_rows.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,6 @@ async fn main() {
2828

2929
while let Some(line) = lines.next_line().await.unwrap() {
3030
let value: serde_json::Value = serde_json::de::from_str(&line).unwrap();
31-
println!("JSONEachRow value: {}", value);
31+
println!("JSONEachRow value: {value}");
3232
}
3333
}

src/insert.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ impl<T> Insert<T> {
128128

129129
// TODO: what about escaping a table name?
130130
// https://clickhouse.com/docs/en/sql-reference/syntax#identifiers
131-
let sql = format!("INSERT INTO {}({}) FORMAT RowBinary", table, fields);
131+
let sql = format!("INSERT INTO {table}({fields}) FORMAT RowBinary");
132132

133133
Ok(Self {
134134
state: InsertState::NotStarted {

src/row_metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ fn join_panic_schema_hint<T: Display>(col: &[T]) -> String {
192192
return String::default();
193193
}
194194
col.iter()
195-
.map(|c| format!("- {}", c))
195+
.map(|c| format!("- {c}"))
196196
.collect::<Vec<String>>()
197197
.join("\n")
198198
}

src/rowbinary/validation.rs

Lines changed: 14 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -72,31 +72,27 @@ impl<'cursor, R: Row> DataTypeValidator<'cursor, R> {
7272
RowKind::Primitive => {
7373
panic!(
7474
"While processing row as a primitive: attempting to deserialize \
75-
ClickHouse type {} as {} which is not compatible",
76-
data_type, serde_type
75+
ClickHouse type {data_type} as {serde_type} which is not compatible"
7776
)
7877
}
7978
RowKind::Vec => {
8079
panic!(
8180
"While processing row as a vector: attempting to deserialize \
82-
ClickHouse type {} as {} which is not compatible",
83-
data_type, serde_type
81+
ClickHouse type {data_type} as {serde_type} which is not compatible"
8482
)
8583
}
8684
RowKind::Tuple => {
8785
panic!(
8886
"While processing row as a tuple: attempting to deserialize \
89-
ClickHouse type {} as {} which is not compatible",
90-
data_type, serde_type
87+
ClickHouse type {data_type} as {serde_type} which is not compatible"
9188
)
9289
}
9390
RowKind::Struct => {
9491
if is_inner {
9592
let (full_name, full_data_type) = self.get_current_column_name_and_type();
9693
panic!(
97-
"While processing column {} defined as {}: attempting to deserialize \
98-
nested ClickHouse type {} as {} which is not compatible",
99-
full_name, full_data_type, data_type, serde_type
94+
"While processing column {full_name} defined as {full_data_type}: attempting to deserialize \
95+
nested ClickHouse type {data_type} as {serde_type} which is not compatible"
10096
)
10197
} else {
10298
panic!(
@@ -143,8 +139,7 @@ impl<'cursor, R: Row> SchemaValidator<R> for DataTypeValidator<'cursor, R> {
143139
_ => {
144140
// should be unreachable
145141
panic!(
146-
"While processing tuple row: expected serde type Tuple(N), got {}",
147-
serde_type
142+
"While processing tuple row: expected serde type Tuple(N), got {serde_type}"
148143
);
149144
}
150145
}
@@ -302,9 +297,8 @@ impl<'cursor, R: Row> SchemaValidator<R> for Option<InnerDataTypeValidator<'_, '
302297
let (full_name, full_data_type) =
303298
inner.root.get_current_column_name_and_type();
304299
panic!(
305-
"While processing column {} defined as {}: \
306-
attempting to deserialize {} while no more elements are allowed",
307-
full_name, full_data_type, serde_type
300+
"While processing column {full_name} defined as {full_data_type}: \
301+
attempting to deserialize {serde_type} while no more elements are allowed"
308302
)
309303
}
310304
}
@@ -320,9 +314,8 @@ impl<'cursor, R: Row> SchemaValidator<R> for Option<InnerDataTypeValidator<'_, '
320314
} else {
321315
let (full_name, full_data_type) = inner.root.get_current_column_name_and_type();
322316
panic!(
323-
"While processing root tuple element {} defined as {}: \
324-
attempting to deserialize {} while no more elements are allowed",
325-
full_name, full_data_type, serde_type
317+
"While processing root tuple element {full_name} defined as {full_data_type}: \
318+
attempting to deserialize {serde_type} while no more elements are allowed"
326319
)
327320
}
328321
}
@@ -564,9 +557,8 @@ fn validate_impl<'de, 'cursor, R: Row>(
564557
} else {
565558
let (full_name, full_data_type) = root.get_current_column_name_and_type();
566559
panic!(
567-
"While processing column {} defined as {}: attempting to deserialize \
568-
nested ClickHouse type {} as {}",
569-
full_name, full_data_type, data_type, serde_type,
560+
"While processing column {full_name} defined as {full_data_type}: attempting to deserialize \
561+
nested ClickHouse type {data_type} as {serde_type}",
570562
)
571563
}
572564
}
@@ -599,10 +591,7 @@ fn validate_impl<'de, 'cursor, R: Row>(
599591
kind: InnerDataTypeValidatorKind::Map(kv, MapValidatorState::Key),
600592
})
601593
} else {
602-
panic!(
603-
"Expected Map for {} call, but got {}",
604-
serde_type, data_type
605-
)
594+
panic!("Expected Map for {serde_type} call, but got {data_type}",)
606595
}
607596
}
608597
SerdeType::Enum => {
@@ -615,10 +604,7 @@ fn validate_impl<'de, 'cursor, R: Row>(
615604
),
616605
})
617606
} else {
618-
panic!(
619-
"Expected Variant for {} call, but got {}",
620-
serde_type, data_type
621-
)
607+
panic!("Expected Variant for {serde_type} call, but got {data_type}")
622608
}
623609
}
624610

src/sql/ser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,13 @@ impl<'a, W: Write> Serializer for SqlSerializer<'a, W> {
112112

113113
#[inline]
114114
fn serialize_i128(self, value: i128) -> Result {
115-
write!(self.writer, "{}::Int128", value)?;
115+
write!(self.writer, "{value}::Int128")?;
116116
Ok(())
117117
}
118118

119119
#[inline]
120120
fn serialize_u128(self, value: u128) -> Result {
121-
write!(self.writer, "{}::UInt128", value)?;
121+
write!(self.writer, "{value}::UInt128")?;
122122
Ok(())
123123
}
124124

tests/it/cloud_jwt.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ async fn test_invalid_jwt_auth() {
2222
let err_msg = format!("{}", result.expect_err("result should be an error"));
2323
assert!(
2424
err_msg.contains("JWT decoding error: invalid token supplied"),
25-
"err_msg = {}",
26-
err_msg
25+
"err_msg = {err_msg}"
2726
);
2827
}

tests/it/cursor_error.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ async fn wait_end_of_query() {
1212
let result = max_execution_time(client.clone(), wait_end_of_query).await;
1313
assert_eq!(
1414
result, expected_rows,
15-
"wait_end_of_query: {}, expected_rows: {}",
16-
wait_end_of_query, expected_rows
15+
"wait_end_of_query: {wait_end_of_query}, expected_rows: {expected_rows}"
1716
);
1817
}
1918
}

tests/it/fetch_bytes.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ async fn error() {
5858
.unwrap();
5959

6060
let err = bytes_cursor.next().await;
61-
println!("{:?}", err);
61+
println!("{err:?}");
6262
assert!(matches!(err, Err(Error::BadResponse(_))));
6363
}
6464

tests/it/https_errors.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,7 @@ async fn test_https_error_on_missing_feature() {
2323
] {
2424
assert!(
2525
result.contains(fragment),
26-
"TLS error message should contain `{}`",
27-
fragment
26+
"TLS error message should contain `{fragment}`"
2827
);
2928
}
3029
}

0 commit comments

Comments
 (0)