mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 11:07:44 +00:00
Merge pull request #8279 from cakebaker/clippy_fix_warnings_in_uucore
clippy: fix warnings from `uninlined_format_args` lint
This commit is contained in:
commit
46cfeadf7c
2 changed files with 13 additions and 17 deletions
|
@ -345,7 +345,7 @@ mod tests {
|
||||||
SeLinuxError::SELinuxNotEnabled => {
|
SeLinuxError::SELinuxNotEnabled => {
|
||||||
// This is the expected error when SELinux is not enabled
|
// This is the expected error when SELinux is not enabled
|
||||||
}
|
}
|
||||||
err => panic!("Expected SELinuxNotEnabled error but got: {}", err),
|
err => panic!("Expected SELinuxNotEnabled error but got: {err}"),
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -372,8 +372,7 @@ mod tests {
|
||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
new_context.contains("tmp_t"),
|
new_context.contains("tmp_t"),
|
||||||
"Expected context to contain 'tmp_t', but got: {}",
|
"Expected context to contain 'tmp_t', but got: {new_context}"
|
||||||
new_context
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
println!(
|
println!(
|
||||||
|
@ -425,7 +424,7 @@ mod tests {
|
||||||
|
|
||||||
if result.is_ok() {
|
if result.is_ok() {
|
||||||
let context = result.unwrap();
|
let context = result.unwrap();
|
||||||
println!("Retrieved SELinux context: {}", context);
|
println!("Retrieved SELinux context: {context}");
|
||||||
|
|
||||||
assert!(
|
assert!(
|
||||||
is_selinux_enabled(),
|
is_selinux_enabled(),
|
||||||
|
@ -435,8 +434,7 @@ mod tests {
|
||||||
if !context.is_empty() {
|
if !context.is_empty() {
|
||||||
assert!(
|
assert!(
|
||||||
context.contains(':'),
|
context.contains(':'),
|
||||||
"SELinux context '{}' doesn't match expected format",
|
"SELinux context '{context}' doesn't match expected format"
|
||||||
context
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -455,7 +453,7 @@ mod tests {
|
||||||
"Got ContextRetrievalFailure when SELinux is not enabled"
|
"Got ContextRetrievalFailure when SELinux is not enabled"
|
||||||
);
|
);
|
||||||
assert!(!e.is_empty(), "Error message should not be empty");
|
assert!(!e.is_empty(), "Error message should not be empty");
|
||||||
println!("Context retrieval failure: {}", e);
|
println!("Context retrieval failure: {e}");
|
||||||
}
|
}
|
||||||
SeLinuxError::ContextConversionFailure(ctx, e) => {
|
SeLinuxError::ContextConversionFailure(ctx, e) => {
|
||||||
assert!(
|
assert!(
|
||||||
|
@ -463,17 +461,16 @@ mod tests {
|
||||||
"Got ContextConversionFailure when SELinux is not enabled"
|
"Got ContextConversionFailure when SELinux is not enabled"
|
||||||
);
|
);
|
||||||
assert!(!e.is_empty(), "Error message should not be empty");
|
assert!(!e.is_empty(), "Error message should not be empty");
|
||||||
println!("Context conversion failure for '{}': {}", ctx, e);
|
println!("Context conversion failure for '{ctx}': {e}");
|
||||||
}
|
}
|
||||||
SeLinuxError::ContextSetFailure(ctx, e) => {
|
SeLinuxError::ContextSetFailure(ctx, e) => {
|
||||||
assert!(!e.is_empty(), "Error message should not be empty");
|
assert!(!e.is_empty(), "Error message should not be empty");
|
||||||
println!("Context conversion failure for '{}': {}", ctx, e);
|
println!("Context conversion failure for '{ctx}': {e}");
|
||||||
}
|
}
|
||||||
SeLinuxError::FileOpenFailure(e) => {
|
SeLinuxError::FileOpenFailure(e) => {
|
||||||
assert!(
|
assert!(
|
||||||
Path::new(path).exists(),
|
Path::new(path).exists(),
|
||||||
"File open failure occurred despite file being created: {}",
|
"File open failure occurred despite file being created: {e}"
|
||||||
e
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -618,10 +615,10 @@ mod tests {
|
||||||
if let Err(err) = result {
|
if let Err(err) = result {
|
||||||
match err {
|
match err {
|
||||||
SeLinuxError::ContextSetFailure(_, _) => {
|
SeLinuxError::ContextSetFailure(_, _) => {
|
||||||
println!("Note: Could not set context due to permissions: {}", err);
|
println!("Note: Could not set context due to permissions: {err}");
|
||||||
}
|
}
|
||||||
unexpected => {
|
unexpected => {
|
||||||
panic!("Unexpected error: {}", unexpected);
|
panic!("Unexpected error: {unexpected}");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1071,12 +1071,12 @@ invalid-syntax = This is { $missing
|
||||||
source: std::io::Error::new(std::io::ErrorKind::NotFound, "File not found"),
|
source: std::io::Error::new(std::io::ErrorKind::NotFound, "File not found"),
|
||||||
path: PathBuf::from("/test/path.ftl"),
|
path: PathBuf::from("/test/path.ftl"),
|
||||||
};
|
};
|
||||||
let error_string = format!("{}", io_error);
|
let error_string = format!("{io_error}");
|
||||||
assert!(error_string.contains("I/O error loading"));
|
assert!(error_string.contains("I/O error loading"));
|
||||||
assert!(error_string.contains("/test/path.ftl"));
|
assert!(error_string.contains("/test/path.ftl"));
|
||||||
|
|
||||||
let bundle_error = LocalizationError::Bundle("Bundle creation failed".to_string());
|
let bundle_error = LocalizationError::Bundle("Bundle creation failed".to_string());
|
||||||
let bundle_string = format!("{}", bundle_error);
|
let bundle_string = format!("{bundle_error}");
|
||||||
assert!(bundle_string.contains("Bundle error: Bundle creation failed"));
|
assert!(bundle_string.contains("Bundle error: Bundle creation failed"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1096,8 +1096,7 @@ invalid-syntax = This is { $missing
|
||||||
// The snippet should contain exactly the invalid text from es-ES.ftl
|
// The snippet should contain exactly the invalid text from es-ES.ftl
|
||||||
assert!(
|
assert!(
|
||||||
snippet.contains("This is { $missing"),
|
snippet.contains("This is { $missing"),
|
||||||
"snippet was `{}` but did not include the invalid text",
|
"snippet was `{snippet}` but did not include the invalid text"
|
||||||
snippet
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
panic!("Expected LocalizationError::ParseResource with snippet");
|
panic!("Expected LocalizationError::ParseResource with snippet");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue