Skip to content

Commit f447346

Browse files
committed
fix: Complete format string modernization for clippy
- Fix all remaining clippy::uninlined_format_args warnings - Update format strings in handlers.rs, auth.rs, and lib.rs - Modernize 13 format! macros to use inline variable syntax - Ensures full compliance with clippy --all-features -- -D warnings
1 parent 8e28ff3 commit f447346

File tree

3 files changed

+13
-16
lines changed

3 files changed

+13
-16
lines changed

datafusion-postgres/src/auth.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ impl AuthManager {
182182

183183
// Create predefined roles
184184
if let Err(e) = auth_manager_spawn.create_predefined_roles().await {
185-
eprintln!("Failed to create predefined roles: {:?}", e);
185+
eprintln!("Failed to create predefined roles: {e:?}");
186186
}
187187
}
188188
});
@@ -282,7 +282,7 @@ impl AuthManager {
282282
pgwire::error::ErrorInfo::new(
283283
"ERROR".to_string(),
284284
"42704".to_string(), // undefined_object
285-
format!("role \"{}\" does not exist", role_name),
285+
format!("role \"{role_name}\" does not exist"),
286286
),
287287
)))
288288
}
@@ -306,7 +306,7 @@ impl AuthManager {
306306
pgwire::error::ErrorInfo::new(
307307
"ERROR".to_string(),
308308
"42704".to_string(), // undefined_object
309-
format!("role \"{}\" does not exist", role_name),
309+
format!("role \"{role_name}\" does not exist"),
310310
),
311311
)))
312312
}
@@ -410,7 +410,7 @@ impl AuthManager {
410410
// Schema grants access to all tables in that schema
411411
(ResourceType::Schema(schema), ResourceType::Table(table)) => {
412412
// For simplicity, assume table names are schema.table format
413-
table.starts_with(&format!("{}.", schema))
413+
table.starts_with(&format!("{schema}."))
414414
}
415415
_ => false,
416416
}
@@ -434,7 +434,7 @@ impl AuthManager {
434434
pgwire::error::ErrorInfo::new(
435435
"ERROR".to_string(),
436436
"42704".to_string(), // undefined_object
437-
format!("role \"{}\" does not exist", child_role),
437+
format!("role \"{child_role}\" does not exist"),
438438
),
439439
)))
440440
}
@@ -456,7 +456,7 @@ impl AuthManager {
456456
pgwire::error::ErrorInfo::new(
457457
"ERROR".to_string(),
458458
"42704".to_string(), // undefined_object
459-
format!("role \"{}\" does not exist", child_role),
459+
format!("role \"{child_role}\" does not exist"),
460460
),
461461
)))
462462
}
@@ -623,7 +623,7 @@ impl StartupHandler for AuthStartupHandler {
623623
pgwire::error::ErrorInfo::new(
624624
"FATAL".to_string(),
625625
"28P01".to_string(), // invalid_password
626-
format!("password authentication failed for user \"{}\"", username),
626+
format!("password authentication failed for user \"{username}\""),
627627
),
628628
)));
629629
}
@@ -670,7 +670,7 @@ impl AuthSource for SimpleAuthSource {
670670
pgwire::error::ErrorInfo::new(
671671
"FATAL".to_string(),
672672
"28P01".to_string(), // invalid_password
673-
format!("password authentication failed for user \"{}\"", username),
673+
format!("password authentication failed for user \"{username}\""),
674674
),
675675
)))
676676
}

datafusion-postgres/src/handlers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ impl DfSessionService {
146146
pgwire::error::ErrorInfo::new(
147147
"ERROR".to_string(),
148148
"42501".to_string(), // insufficient_privilege
149-
format!("permission denied for user \"{}\"", username),
149+
format!("permission denied for user \"{username}\""),
150150
),
151151
)));
152152
}

datafusion-postgres/src/lib.rs

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,11 @@ pub async fn serve(
8585
if let (Some(cert_path), Some(key_path)) = (&opts.tls_cert_path, &opts.tls_key_path) {
8686
match setup_tls(cert_path, key_path) {
8787
Ok(acceptor) => {
88-
println!(
89-
"TLS enabled using cert: {} and key: {}",
90-
cert_path, key_path
91-
);
88+
println!("TLS enabled using cert: {cert_path} and key: {key_path}");
9289
Some(acceptor)
9390
}
9491
Err(e) => {
95-
eprintln!("Failed to setup TLS: {}. Running without encryption.", e);
92+
eprintln!("Failed to setup TLS: {e}. Running without encryption.");
9693
None
9794
}
9895
}
@@ -106,9 +103,9 @@ pub async fn serve(
106103
let listener = TcpListener::bind(&server_addr).await?;
107104

108105
if tls_acceptor.is_some() {
109-
println!("Listening on {} with TLS encryption", server_addr);
106+
println!("Listening on {server_addr} with TLS encryption");
110107
} else {
111-
println!("Listening on {} (unencrypted)", server_addr);
108+
println!("Listening on {server_addr} (unencrypted)");
112109
}
113110

114111
// Accept incoming connections

0 commit comments

Comments
 (0)