Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/uu/base32/src/base_common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -839,8 +839,7 @@ mod tests {
assert_eq!(
has_padding(&mut cursor).unwrap(),
expected,
"Failed for input: '{}'",
input
"Failed for input: '{input}'"
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/uu/chgrp/src/chgrp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ fn parse_gid_from_str(group: &str) -> Result<u32, String> {
// Handle :gid format
gid_str
.parse::<u32>()
.map_err(|_| format!("invalid group id: '{}'", gid_str))
.map_err(|_| format!("invalid group id: '{gid_str}'"))
} else {
// Try as group name first
match entries::grp2gid(group) {
Ok(g) => Ok(g),
// If group name lookup fails, try parsing as raw number
Err(_) => group
.parse::<u32>()
.map_err(|_| format!("invalid group: '{}'", group)),
.map_err(|_| format!("invalid group: '{group}'")),
}
}
}
Expand Down Expand Up @@ -75,7 +75,7 @@ fn parse_gid_and_uid(matches: &ArgMatches) -> UResult<GidUidOwnerFilter> {
Err(_) => {
return Err(USimpleError::new(
1,
format!("invalid user: '{}'", from_group),
format!("invalid user: '{from_group}'"),
));
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/uu/env/src/env.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,19 +317,19 @@ pub fn parse_args_from_str(text: &NativeIntStr) -> UResult<Vec<NativeIntString>>
}
EnvError::EnvMissingClosingQuote(_, _) => USimpleError::new(125, e.to_string()),
EnvError::EnvParsingOfVariableMissingClosingBrace(pos) => {
USimpleError::new(125, format!("variable name issue (at {pos}): {}", e))
USimpleError::new(125, format!("variable name issue (at {pos}): {e}"))
}
EnvError::EnvParsingOfMissingVariable(pos) => {
USimpleError::new(125, format!("variable name issue (at {pos}): {}", e))
USimpleError::new(125, format!("variable name issue (at {pos}): {e}"))
}
EnvError::EnvParsingOfVariableMissingClosingBraceAfterValue(pos) => {
USimpleError::new(125, format!("variable name issue (at {pos}): {}", e))
USimpleError::new(125, format!("variable name issue (at {pos}): {e}"))
}
EnvError::EnvParsingOfVariableUnexpectedNumber(pos, _) => {
USimpleError::new(125, format!("variable name issue (at {pos}): {}", e))
USimpleError::new(125, format!("variable name issue (at {pos}): {e}"))
}
EnvError::EnvParsingOfVariableExceptedBraceOrColon(pos, _) => {
USimpleError::new(125, format!("variable name issue (at {pos}): {}", e))
USimpleError::new(125, format!("variable name issue (at {pos}): {e}"))
}
_ => USimpleError::new(125, format!("Error: {e:?}")),
})
Expand Down
2 changes: 1 addition & 1 deletion src/uu/head/src/head.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ impl HeadOptions {
fn wrap_in_stdout_error(err: io::Error) -> io::Error {
io::Error::new(
err.kind(),
format!("error writing 'standard output': {}", err),
format!("error writing 'standard output': {err}"),
)
}

Expand Down
5 changes: 1 addition & 4 deletions src/uu/join/src/join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -734,10 +734,7 @@ fn parse_separator(value_os: &OsString) -> UResult<SepSetting> {
match chars.next() {
None => Ok(SepSetting::Char(value.into())),
Some('0') if c == '\\' => Ok(SepSetting::Byte(0)),
_ => Err(USimpleError::new(
1,
format!("multi-character tab {}", value),
)),
_ => Err(USimpleError::new(1, format!("multi-character tab {value}"))),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/uu/ln/src/ln.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ enum LnError {
MissingDestination(PathBuf),

#[error("extra operand {}\nTry '{} --help' for more information.",
format!("{:?}", _0).trim_matches('"'), _1)]
format!("{_0:?}").trim_matches('"'), _1)]
ExtraOperand(OsString, String),
}

Expand Down
16 changes: 8 additions & 8 deletions src/uu/stat/src/stat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl std::str::FromStr for QuotingStyle {
"shell" => Ok(QuotingStyle::Shell),
"shell-escape-always" => Ok(QuotingStyle::ShellEscapeAlways),
// The others aren't exposed to the user
_ => Err(format!("Invalid quoting style: {}", s)),
_ => Err(format!("Invalid quoting style: {s}")),
}
}
}
Expand Down Expand Up @@ -335,9 +335,9 @@ fn quote_file_name(file_name: &str, quoting_style: &QuotingStyle) -> String {
match quoting_style {
QuotingStyle::Locale | QuotingStyle::Shell => {
let escaped = file_name.replace('\'', r"\'");
format!("'{}'", escaped)
format!("'{escaped}'")
}
QuotingStyle::ShellEscapeAlways => format!("\"{}\"", file_name),
QuotingStyle::ShellEscapeAlways => format!("\"{file_name}\""),
QuotingStyle::Quote => file_name.to_string(),
}
}
Expand Down Expand Up @@ -450,7 +450,7 @@ fn print_integer(
let extended = match precision {
Precision::NotSpecified => format!("{prefix}{arg}"),
Precision::NoNumber => format!("{prefix}{arg}"),
Precision::Number(p) => format!("{prefix}{arg:0>precision$}", precision = p),
Precision::Number(p) => format!("{prefix}{arg:0>p$}"),
};
pad_and_print(&extended, flags.left, width, padding_char);
}
Expand Down Expand Up @@ -532,7 +532,7 @@ fn print_unsigned(
let s = match precision {
Precision::NotSpecified => s,
Precision::NoNumber => s,
Precision::Number(p) => format!("{s:0>precision$}", precision = p).into(),
Precision::Number(p) => format!("{s:0>p$}").into(),
};
pad_and_print(&s, flags.left, width, padding_char);
}
Expand All @@ -557,7 +557,7 @@ fn print_unsigned_oct(
let s = match precision {
Precision::NotSpecified => format!("{prefix}{num:o}"),
Precision::NoNumber => format!("{prefix}{num:o}"),
Precision::Number(p) => format!("{prefix}{num:0>precision$o}", precision = p),
Precision::Number(p) => format!("{prefix}{num:0>p$o}"),
};
pad_and_print(&s, flags.left, width, padding_char);
}
Expand All @@ -582,7 +582,7 @@ fn print_unsigned_hex(
let s = match precision {
Precision::NotSpecified => format!("{prefix}{num:x}"),
Precision::NoNumber => format!("{prefix}{num:x}"),
Precision::Number(p) => format!("{prefix}{num:0>precision$x}", precision = p),
Precision::Number(p) => format!("{prefix}{num:0>p$x}"),
};
pad_and_print(&s, flags.left, width, padding_char);
}
Expand Down Expand Up @@ -994,7 +994,7 @@ impl Stater {
'R' => {
let major = meta.rdev() >> 8;
let minor = meta.rdev() & 0xff;
OutputType::Str(format!("{},{}", major, minor))
OutputType::Str(format!("{major},{minor}"))
}
'r' => OutputType::Unsigned(meta.rdev()),
'H' => OutputType::Unsigned(meta.rdev() >> 8), // Major in decimal
Expand Down
2 changes: 1 addition & 1 deletion src/uu/stdbuf/src/stdbuf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
127,
format!("{EXEC_ERROR} No such file or directory"),
)),
_ => Err(USimpleError::new(1, format!("{EXEC_ERROR} {}", e))),
_ => Err(USimpleError::new(1, format!("{EXEC_ERROR} {e}"))),
};
}
};
Expand Down
2 changes: 1 addition & 1 deletion src/uu/uptime/src/uptime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ fn default_uptime(matches: &ArgMatches) -> UResult<()> {
fn print_loadavg() {
match get_formatted_loadavg() {
Err(_) => {}
Ok(s) => println!("{}", s),
Ok(s) => println!("{s}"),
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/uucore/src/lib/features/backup_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ fn numbered_backup_path(path: &Path) -> PathBuf {
let file_name = path.file_name().unwrap_or_default();
for i in 1_u64.. {
let mut numbered_file_name = file_name.to_os_string();
numbered_file_name.push(format!(".~{}~", i));
numbered_file_name.push(format!(".~{i}~"));
let path = path.with_file_name(numbered_file_name);
if !path.exists() {
return path;
Expand Down
4 changes: 2 additions & 2 deletions src/uucore/src/lib/features/buf_copy/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ pub enum Error {
impl std::fmt::Display for Error {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Error::WriteError(msg) => write!(f, "splice() write error: {}", msg),
Error::Io(err) => write!(f, "I/O error: {}", err),
Error::WriteError(msg) => write!(f, "splice() write error: {msg}"),
Error::Io(err) => write!(f, "I/O error: {err}"),
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/uucore/src/lib/features/quoting_style.rs
Original file line number Diff line number Diff line change
Expand Up @@ -863,7 +863,7 @@ mod tests {
("????????????????", "shell"),
(test_str, "shell-show"),
("'????????????????'", "shell-always"),
(&format!("'{}'", test_str), "shell-always-show"),
(&format!("'{test_str}'"), "shell-always-show"),
(
"''$'\\302\\200\\302\\201\\302\\202\\302\\203\\302\\204\\302\\205\\302\\206\\302\\207\\302\\210\\302\\211\\302\\212\\302\\213\\302\\214\\302\\215\\302\\216\\302\\217'",
"shell-escape",
Expand Down Expand Up @@ -893,7 +893,7 @@ mod tests {
("????????????????", "shell"),
(test_str, "shell-show"),
("'????????????????'", "shell-always"),
(&format!("'{}'", test_str), "shell-always-show"),
(&format!("'{test_str}'"), "shell-always-show"),
(
"''$'\\302\\220\\302\\221\\302\\222\\302\\223\\302\\224\\302\\225\\302\\226\\302\\227\\302\\230\\302\\231\\302\\232\\302\\233\\302\\234\\302\\235\\302\\236\\302\\237'",
"shell-escape",
Expand Down
2 changes: 1 addition & 1 deletion src/uucore/src/lib/features/uptime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ pub fn format_nusers(nusers: usize) -> String {
match nusers {
0 => "0 user".to_string(),
1 => "1 user".to_string(),
_ => format!("{} users", nusers),
_ => format!("{nusers} users"),
}
}

Expand Down
4 changes: 1 addition & 3 deletions tests/by-util/test_cp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6093,9 +6093,7 @@ fn test_cp_preserve_xattr_readonly_source() {
let stdout = String::from_utf8_lossy(&getfattr_output.stdout);
assert!(
stdout.contains(xattr_key),
"Expected '{}' not found in getfattr output:\n{}",
xattr_key,
stdout
"Expected '{xattr_key}' not found in getfattr output:\n{stdout}"
);

at.set_readonly(source_file);
Expand Down
2 changes: 1 addition & 1 deletion tests/by-util/test_csplit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1457,7 +1457,7 @@ fn create_named_pipe_with_writer(path: &str, data: &str) -> std::process::Child
nix::unistd::mkfifo(path, nix::sys::stat::Mode::S_IRWXU).unwrap();
std::process::Command::new("sh")
.arg("-c")
.arg(format!("printf '{}' > {path}", data))
.arg(format!("printf '{data}' > {path}"))
.spawn()
.unwrap()
}
Expand Down
4 changes: 2 additions & 2 deletions tests/by-util/test_head.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ fn test_all_but_last_bytes_large_file_piped() {
.len();
scene
.ucmd()
.args(&["-c", &format!("-{}", seq_19001_20000_file_length)])
.args(&["-c", &format!("-{seq_19001_20000_file_length}")])
.pipe_in_fixture(seq_20000_file_name)
.succeeds()
.stdout_only_fixture(seq_19000_file_name);
Expand Down Expand Up @@ -695,7 +695,7 @@ fn test_validate_stdin_offset_bytes() {
.len();
scene
.ucmd()
.args(&["-c", &format!("-{}", seq_19001_20000_file_length)])
.args(&["-c", &format!("-{seq_19001_20000_file_length}")])
.set_stdin(file)
.succeeds()
.stdout_only_fixture(seq_19000_file_name);
Expand Down
2 changes: 1 addition & 1 deletion tests/test_util_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ fn init() {
std::env::set_var("UUTESTS_BINARY_PATH", TESTS_BINARY);
}
// Print for debugging
eprintln!("Setting UUTESTS_BINARY_PATH={}", TESTS_BINARY);
eprintln!("Setting UUTESTS_BINARY_PATH={TESTS_BINARY}");
}

#[test]
Expand Down
Loading