Skip to content

Commit ef58aaf

Browse files
committed
chore: inline format args
The `uninlined_format_args` lint became default in a recent version of rust.
1 parent d3d3127 commit ef58aaf

File tree

74 files changed

+241
-442
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+241
-442
lines changed

crates/catalog/glue/src/catalog.rs

Lines changed: 9 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ impl Catalog for GlueCatalog {
293293
}
294294
None => Err(Error::new(
295295
ErrorKind::DataInvalid,
296-
format!("Database with name: {} does not exist", db_name),
296+
format!("Database with name: {db_name} does not exist"),
297297
)),
298298
}
299299
}
@@ -531,8 +531,7 @@ impl Catalog for GlueCatalog {
531531
None => Err(Error::new(
532532
ErrorKind::TableNotFound,
533533
format!(
534-
"Table object for database: {} and table: {} does not exist",
535-
db_name, table_name
534+
"Table object for database: {db_name} and table: {table_name} does not exist"
536535
),
537536
)),
538537
Some(table) => {
@@ -643,8 +642,7 @@ impl Catalog for GlueCatalog {
643642
None => Err(Error::new(
644643
ErrorKind::TableNotFound,
645644
format!(
646-
"'Table' object for database: {} and table: {} does not exist",
647-
src_db_name, src_table_name
645+
"'Table' object for database: {src_db_name} and table: {src_table_name} does not exist"
648646
),
649647
)),
650648
Some(table) => {
@@ -672,26 +670,22 @@ impl Catalog for GlueCatalog {
672670
match drop_src_table_result {
673671
Ok(_) => Ok(()),
674672
Err(_) => {
675-
let err_msg_src_table = format!(
676-
"Failed to drop old table {}.{}.",
677-
src_db_name, src_table_name
678-
);
673+
let err_msg_src_table =
674+
format!("Failed to drop old table {src_db_name}.{src_table_name}.");
679675

680676
let drop_dest_table_result = self.drop_table(dest).await;
681677

682678
match drop_dest_table_result {
683679
Ok(_) => Err(Error::new(
684680
ErrorKind::Unexpected,
685681
format!(
686-
"{} Rolled back table creation for {}.{}.",
687-
err_msg_src_table, dest_db_name, dest_table_name
682+
"{err_msg_src_table} Rolled back table creation for {dest_db_name}.{dest_table_name}."
688683
),
689684
)),
690685
Err(_) => Err(Error::new(
691686
ErrorKind::Unexpected,
692687
format!(
693-
"{} Failed to roll back table creation for {}.{}. Please clean up manually.",
694-
err_msg_src_table, dest_db_name, dest_table_name
688+
"{err_msg_src_table} Failed to roll back table creation for {dest_db_name}.{dest_table_name}. Please clean up manually."
695689
),
696690
)),
697691
}
@@ -753,7 +747,7 @@ impl Catalog for GlueCatalog {
753747
format!("Failed to register table {table_ident} due to AWS SDK error"),
754748
),
755749
}
756-
.with_source(anyhow!("aws sdk error: {:?}", error))
750+
.with_source(anyhow!("aws sdk error: {error:?}"))
757751
})?;
758752

759753
Ok(Table::builder()
@@ -811,7 +805,7 @@ impl Catalog for GlueCatalog {
811805
format!("Operation failed for table: {table_ident} for hitting aws sdk error"),
812806
),
813807
}
814-
.with_source(anyhow!("aws sdk error: {:?}", error))
808+
.with_source(anyhow!("aws sdk error: {error:?}"))
815809
})?;
816810

817811
Ok(staged_table)

crates/catalog/glue/src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ where T: Debug {
2727
ErrorKind::Unexpected,
2828
"Operation failed for hitting aws sdk error".to_string(),
2929
)
30-
.with_source(anyhow!("aws sdk error: {:?}", error))
30+
.with_source(anyhow!("aws sdk error: {error:?}"))
3131
}
3232

3333
/// Format AWS Build error into iceberg error
@@ -36,5 +36,5 @@ pub(crate) fn from_aws_build_error(error: aws_sdk_glue::error::BuildError) -> Er
3636
ErrorKind::Unexpected,
3737
"Operation failed for hitting aws build error".to_string(),
3838
)
39-
.with_source(anyhow!("aws build error: {:?}", error))
39+
.with_source(anyhow!("aws build error: {error:?}"))
4040
}

crates/catalog/glue/src/schema.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ impl SchemaVisitor for GlueSchemaBuilder {
143143
}
144144

145145
fn list(&mut self, _list: &iceberg::spec::ListType, value: String) -> iceberg::Result<String> {
146-
Ok(format!("array<{}>", value))
146+
Ok(format!("array<{value}>"))
147147
}
148148

149149
fn map(
@@ -152,7 +152,7 @@ impl SchemaVisitor for GlueSchemaBuilder {
152152
key_value: String,
153153
value: String,
154154
) -> iceberg::Result<String> {
155-
Ok(format!("map<{},{}>", key_value, value))
155+
Ok(format!("map<{key_value},{value}>"))
156156
}
157157

158158
fn primitive(&mut self, p: &iceberg::spec::PrimitiveType) -> iceberg::Result<Self::T> {
@@ -171,7 +171,7 @@ impl SchemaVisitor for GlueSchemaBuilder {
171171
}
172172
PrimitiveType::Binary | PrimitiveType::Fixed(_) => "binary".to_string(),
173173
PrimitiveType::Decimal { precision, scale } => {
174-
format!("decimal({},{})", precision, scale)
174+
format!("decimal({precision},{scale})")
175175
}
176176
_ => {
177177
return Err(Error::new(

crates/catalog/glue/src/utils.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,7 @@ pub(crate) fn validate_namespace(namespace: &NamespaceIdent) -> Result<String> {
185185
return Err(Error::new(
186186
ErrorKind::DataInvalid,
187187
format!(
188-
"Invalid database name: {:?}, hierarchical namespaces are not supported",
189-
namespace
188+
"Invalid database name: {namespace:?}, hierarchical namespaces are not supported"
190189
),
191190
));
192191
}
@@ -236,7 +235,7 @@ pub(crate) fn get_metadata_location(
236235
Some(location) => Ok(location.to_string()),
237236
None => Err(Error::new(
238237
ErrorKind::DataInvalid,
239-
format!("No '{}' set on table", METADATA_LOCATION),
238+
format!("No '{METADATA_LOCATION}' set on table"),
240239
)),
241240
},
242241
None => Err(Error::new(

crates/catalog/glue/tests/glue_catalog_test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ async fn get_catalog() -> GlueCatalog {
9191
(AWS_REGION_NAME.to_string(), "us-east-1".to_string()),
9292
(
9393
S3_ENDPOINT.to_string(),
94-
format!("http://{}", minio_socket_addr),
94+
format!("http://{minio_socket_addr}"),
9595
),
9696
(S3_ACCESS_KEY_ID.to_string(), "admin".to_string()),
9797
(S3_SECRET_ACCESS_KEY.to_string(), "password".to_string()),
@@ -119,7 +119,7 @@ async fn get_catalog() -> GlueCatalog {
119119
let mut glue_props = HashMap::from([
120120
(
121121
GLUE_CATALOG_PROP_URI.to_string(),
122-
format!("http://{}", glue_socket_addr),
122+
format!("http://{glue_socket_addr}"),
123123
),
124124
(
125125
GLUE_CATALOG_PROP_WAREHOUSE.to_string(),

crates/catalog/hms/src/catalog.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ impl Catalog for HmsCatalog {
321321
ErrorKind::Unexpected,
322322
"Operation failed for hitting thrift error".to_string(),
323323
)
324-
.with_source(anyhow!("thrift error: {:?}", exception))),
324+
.with_source(anyhow!("thrift error: {exception:?}"))),
325325
Err(err) => Err(from_thrift_error(err)),
326326
}
327327
}
@@ -554,7 +554,7 @@ impl Catalog for HmsCatalog {
554554
ErrorKind::Unexpected,
555555
"Operation failed for hitting thrift error".to_string(),
556556
)
557-
.with_source(anyhow!("thrift error: {:?}", exception))),
557+
.with_source(anyhow!("thrift error: {exception:?}"))),
558558
Err(err) => Err(from_thrift_error(err)),
559559
}
560560
}

crates/catalog/hms/src/error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub fn from_thrift_error(error: impl std::error::Error) -> Error {
3030
ErrorKind::Unexpected,
3131
"Operation failed for hitting thrift error".to_string(),
3232
)
33-
.with_source(anyhow!("thrift error: {:?}", error))
33+
.with_source(anyhow!("thrift error: {error:?}"))
3434
}
3535

3636
/// Format a thrift exception into iceberg error.
@@ -41,7 +41,7 @@ pub fn from_thrift_exception<T, E: Debug>(value: MaybeException<T, E>) -> Result
4141
ErrorKind::Unexpected,
4242
"Operation failed for hitting thrift error".to_string(),
4343
)
44-
.with_source(anyhow!("thrift error: {:?}", err))),
44+
.with_source(anyhow!("thrift error: {err:?}"))),
4545
}
4646
}
4747

crates/catalog/hms/src/schema.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ impl SchemaVisitor for HiveSchemaBuilder {
100100
}
101101

102102
fn list(&mut self, _list: &iceberg::spec::ListType, value: String) -> iceberg::Result<String> {
103-
Ok(format!("array<{}>", value))
103+
Ok(format!("array<{value}>"))
104104
}
105105

106106
fn map(
@@ -109,7 +109,7 @@ impl SchemaVisitor for HiveSchemaBuilder {
109109
key_value: String,
110110
value: String,
111111
) -> iceberg::Result<String> {
112-
Ok(format!("map<{},{}>", key_value, value))
112+
Ok(format!("map<{key_value},{value}>"))
113113
}
114114

115115
fn primitive(&mut self, p: &iceberg::spec::PrimitiveType) -> iceberg::Result<String> {
@@ -128,7 +128,7 @@ impl SchemaVisitor for HiveSchemaBuilder {
128128
}
129129
PrimitiveType::Binary | PrimitiveType::Fixed(_) => "binary".to_string(),
130130
PrimitiveType::Decimal { precision, scale } => {
131-
format!("decimal({},{})", precision, scale)
131+
format!("decimal({precision},{scale})")
132132
}
133133
_ => {
134134
return Err(Error::new(

crates/catalog/hms/src/utils.rs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ pub(crate) fn convert_to_database(
128128
_ => {
129129
return Err(Error::new(
130130
ErrorKind::DataInvalid,
131-
format!("Invalid value for setting 'owner_type': {}", v),
131+
format!("Invalid value for setting 'owner_type': {v}"),
132132
));
133133
}
134134
};
@@ -214,8 +214,7 @@ pub(crate) fn validate_namespace(namespace: &NamespaceIdent) -> Result<String> {
214214
return Err(Error::new(
215215
ErrorKind::DataInvalid,
216216
format!(
217-
"Invalid database name: {:?}, hierarchical namespaces are not supported",
218-
namespace
217+
"Invalid database name: {namespace:?}, hierarchical namespaces are not supported"
219218
),
220219
));
221220
}
@@ -257,7 +256,7 @@ pub(crate) fn get_metadata_location(
257256
Some(location) => Ok(location.to_string()),
258257
None => Err(Error::new(
259258
ErrorKind::DataInvalid,
260-
format!("No '{}' set on table", METADATA_LOCATION),
259+
format!("No '{METADATA_LOCATION}' set on table"),
261260
)),
262261
},
263262
None => Err(Error::new(
@@ -272,7 +271,7 @@ fn format_location_uri(location: String) -> String {
272271
let mut location = location;
273272

274273
if !location.starts_with('/') {
275-
location = format!("/{}", location);
274+
location = format!("/{location}");
276275
}
277276

278277
if location.ends_with('/') && location.len() > 1 {
@@ -292,8 +291,7 @@ fn validate_owner_settings(properties: &HashMap<String, String>) -> Result<()> {
292291
return Err(Error::new(
293292
ErrorKind::DataInvalid,
294293
format!(
295-
"Setting '{}' without setting '{}' is not allowed",
296-
HMS_DB_OWNER_TYPE, HMS_DB_OWNER
294+
"Setting '{HMS_DB_OWNER_TYPE}' without setting '{HMS_DB_OWNER}' is not allowed"
297295
),
298296
));
299297
}

crates/catalog/hms/tests/hms_catalog_test.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ async fn get_catalog() -> HmsCatalog {
9696
),
9797
(
9898
S3_ENDPOINT.to_string(),
99-
format!("http://{}", minio_socket_addr),
99+
format!("http://{minio_socket_addr}"),
100100
),
101101
(S3_ACCESS_KEY_ID.to_string(), "admin".to_string()),
102102
(S3_SECRET_ACCESS_KEY.to_string(), "password".to_string()),

0 commit comments

Comments
 (0)