Skip to content

Commit 2c64a34

Browse files
committed
clippy: fix warnings from uninlined_format_args
1 parent fb2399f commit 2c64a34

2 files changed

Lines changed: 13 additions & 17 deletions

File tree

src/uucore/src/lib/features/selinux.rs

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ mod tests {
345345
SeLinuxError::SELinuxNotEnabled => {
346346
// This is the expected error when SELinux is not enabled
347347
}
348-
err => panic!("Expected SELinuxNotEnabled error but got: {}", err),
348+
err => panic!("Expected SELinuxNotEnabled error but got: {err}"),
349349
}
350350
return;
351351
}
@@ -372,8 +372,7 @@ mod tests {
372372

373373
assert!(
374374
new_context.contains("tmp_t"),
375-
"Expected context to contain 'tmp_t', but got: {}",
376-
new_context
375+
"Expected context to contain 'tmp_t', but got: {new_context}"
377376
);
378377
} else {
379378
println!(
@@ -425,7 +424,7 @@ mod tests {
425424

426425
if result.is_ok() {
427426
let context = result.unwrap();
428-
println!("Retrieved SELinux context: {}", context);
427+
println!("Retrieved SELinux context: {context}");
429428

430429
assert!(
431430
is_selinux_enabled(),
@@ -435,8 +434,7 @@ mod tests {
435434
if !context.is_empty() {
436435
assert!(
437436
context.contains(':'),
438-
"SELinux context '{}' doesn't match expected format",
439-
context
437+
"SELinux context '{context}' doesn't match expected format"
440438
);
441439
}
442440
} else {
@@ -455,25 +453,24 @@ mod tests {
455453
"Got ContextRetrievalFailure when SELinux is not enabled"
456454
);
457455
assert!(!e.is_empty(), "Error message should not be empty");
458-
println!("Context retrieval failure: {}", e);
456+
println!("Context retrieval failure: {e}");
459457
}
460458
SeLinuxError::ContextConversionFailure(ctx, e) => {
461459
assert!(
462460
is_selinux_enabled(),
463461
"Got ContextConversionFailure when SELinux is not enabled"
464462
);
465463
assert!(!e.is_empty(), "Error message should not be empty");
466-
println!("Context conversion failure for '{}': {}", ctx, e);
464+
println!("Context conversion failure for '{ctx}': {e}");
467465
}
468466
SeLinuxError::ContextSetFailure(ctx, e) => {
469467
assert!(!e.is_empty(), "Error message should not be empty");
470-
println!("Context conversion failure for '{}': {}", ctx, e);
468+
println!("Context conversion failure for '{ctx}': {e}");
471469
}
472470
SeLinuxError::FileOpenFailure(e) => {
473471
assert!(
474472
Path::new(path).exists(),
475-
"File open failure occurred despite file being created: {}",
476-
e
473+
"File open failure occurred despite file being created: {e}"
477474
);
478475
}
479476
}
@@ -618,10 +615,10 @@ mod tests {
618615
if let Err(err) = result {
619616
match err {
620617
SeLinuxError::ContextSetFailure(_, _) => {
621-
println!("Note: Could not set context due to permissions: {}", err);
618+
println!("Note: Could not set context due to permissions: {err}");
622619
}
623620
unexpected => {
624-
panic!("Unexpected error: {}", unexpected);
621+
panic!("Unexpected error: {unexpected}");
625622
}
626623
}
627624
}

src/uucore/src/lib/mods/locale.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,12 +1071,12 @@ invalid-syntax = This is { $missing
10711071
source: std::io::Error::new(std::io::ErrorKind::NotFound, "File not found"),
10721072
path: PathBuf::from("/test/path.ftl"),
10731073
};
1074-
let error_string = format!("{}", io_error);
1074+
let error_string = format!("{io_error}");
10751075
assert!(error_string.contains("I/O error loading"));
10761076
assert!(error_string.contains("/test/path.ftl"));
10771077

10781078
let bundle_error = LocalizationError::Bundle("Bundle creation failed".to_string());
1079-
let bundle_string = format!("{}", bundle_error);
1079+
let bundle_string = format!("{bundle_error}");
10801080
assert!(bundle_string.contains("Bundle error: Bundle creation failed"));
10811081
}
10821082

@@ -1096,8 +1096,7 @@ invalid-syntax = This is { $missing
10961096
// The snippet should contain exactly the invalid text from es-ES.ftl
10971097
assert!(
10981098
snippet.contains("This is { $missing"),
1099-
"snippet was `{}` but did not include the invalid text",
1100-
snippet
1099+
"snippet was `{snippet}` but did not include the invalid text"
11011100
);
11021101
} else {
11031102
panic!("Expected LocalizationError::ParseResource with snippet");

0 commit comments

Comments
 (0)