1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 11:07:44 +00:00

Merge pull request #8303 from nyurik/inefficient_to_string

chore: cleanup `inefficient_to_string` lint
This commit is contained in:
Dorian Péron 2025-07-07 23:12:33 +02:00 committed by GitHub
commit 2f16b14d6c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 13 additions and 14 deletions

View file

@ -645,7 +645,6 @@ redundant_else = "allow" # 58
map_unwrap_or = "allow" # 54 map_unwrap_or = "allow" # 54
cast_precision_loss = "allow" # 52 cast_precision_loss = "allow" # 52
unnested_or_patterns = "allow" # 40 unnested_or_patterns = "allow" # 40
inefficient_to_string = "allow" # 38
unnecessary_wraps = "allow" # 37 unnecessary_wraps = "allow" # 37
cast_lossless = "allow" # 33 cast_lossless = "allow" # 33
ignored_unit_patterns = "allow" # 29 ignored_unit_patterns = "allow" # 29

View file

@ -152,7 +152,7 @@ mod tests {
} }
fn obsolete_result(src: &[&str]) -> Option<Result<Vec<String>, ParseError>> { fn obsolete_result(src: &[&str]) -> Option<Result<Vec<String>, ParseError>> {
Some(Ok(src.iter().map(|s| s.to_string()).collect())) Some(Ok(src.iter().map(|s| (*s).to_string()).collect()))
} }
#[test] #[test]

View file

@ -38,7 +38,7 @@ enum NohupError {
#[error("{}", get_message("nohup-error-cannot-detach"))] #[error("{}", get_message("nohup-error-cannot-detach"))]
CannotDetach, CannotDetach,
#[error("{}", get_message_with_args("nohup-error-cannot-replace", HashMap::from([("name".to_string(), _0.to_string()), ("err".to_string(), _1.to_string())])))] #[error("{}", get_message_with_args("nohup-error-cannot-replace", HashMap::from([("name".to_string(), (*_0).to_string()), ("err".to_string(), _1.to_string())])))]
CannotReplace(&'static str, #[source] Error), CannotReplace(&'static str, #[source] Error),
#[error("{}", get_message_with_args("nohup-error-open-failed", HashMap::from([("path".to_string(), NOHUP_OUT.quote().to_string()), ("err".to_string(), _1.to_string())])))] #[error("{}", get_message_with_args("nohup-error-open-failed", HashMap::from([("path".to_string(), NOHUP_OUT.quote().to_string()), ("err".to_string(), _1.to_string())])))]

View file

@ -330,7 +330,7 @@ fn parse_type_string(params: &str) -> Result<Vec<ParsedFormatterItemInfo>, Strin
#[cfg(test)] #[cfg(test)]
pub fn parse_format_flags_str(args_str: &[&'static str]) -> Result<Vec<FormatterItemInfo>, String> { pub fn parse_format_flags_str(args_str: &[&'static str]) -> Result<Vec<FormatterItemInfo>, String> {
let args: Vec<String> = args_str.iter().map(|s| s.to_string()).collect(); let args: Vec<String> = args_str.iter().map(|s| (*s).to_string()).collect();
parse_format_flags(&args).map(|v| { parse_format_flags(&args).map(|v| {
// tests using this function assume add_ascii_dump is not set // tests using this function assume add_ascii_dump is not set
v.into_iter() v.into_iter()

View file

@ -198,7 +198,7 @@ enum PtxError {
#[error("{}", get_message("ptx-error-dumb-format"))] #[error("{}", get_message("ptx-error-dumb-format"))]
DumbFormat, DumbFormat,
#[error("{}", get_message_with_args("ptx-error-not-implemented", HashMap::from([("feature".to_string(), .0.to_string())])))] #[error("{}", get_message_with_args("ptx-error-not-implemented", HashMap::from([("feature".to_string(), (*.0).to_string())])))]
NotImplemented(&'static str), NotImplemented(&'static str),
#[error("{0}")] #[error("{0}")]

View file

@ -270,7 +270,7 @@ fn stty(opts: &Options) -> UResult<()> {
1, 1,
get_message_with_args( get_message_with_args(
"stty-error-missing-argument", "stty-error-missing-argument",
HashMap::from([("arg".to_string(), arg.to_string())]), HashMap::from([("arg".to_string(), (*arg).to_string())]),
), ),
)); ));
} }
@ -286,8 +286,8 @@ fn stty(opts: &Options) -> UResult<()> {
get_message_with_args( get_message_with_args(
"stty-error-invalid-speed", "stty-error-invalid-speed",
HashMap::from([ HashMap::from([
("arg".to_string(), arg.to_string()), ("arg".to_string(), (*arg).to_string()),
("speed".to_string(), speed.to_string()), ("speed".to_string(), (*speed).to_string()),
]), ]),
), ),
)); ));
@ -298,7 +298,7 @@ fn stty(opts: &Options) -> UResult<()> {
1, 1,
get_message_with_args( get_message_with_args(
"stty-error-missing-argument", "stty-error-missing-argument",
HashMap::from([("arg".to_string(), arg.to_string())]), HashMap::from([("arg".to_string(), (*arg).to_string())]),
), ),
)); ));
} }
@ -372,7 +372,7 @@ fn stty(opts: &Options) -> UResult<()> {
1, 1,
get_message_with_args( get_message_with_args(
"stty-error-invalid-argument", "stty-error-invalid-argument",
HashMap::from([("arg".to_string(), arg.to_string())]), HashMap::from([("arg".to_string(), (*arg).to_string())]),
), ),
)); ));
} }
@ -395,7 +395,7 @@ fn stty(opts: &Options) -> UResult<()> {
1, 1,
get_message_with_args( get_message_with_args(
"stty-error-missing-argument", "stty-error-missing-argument",
HashMap::from([("arg".to_string(), arg.to_string())]), HashMap::from([("arg".to_string(), (*arg).to_string())]),
), ),
)); ));
} }
@ -417,7 +417,7 @@ fn stty(opts: &Options) -> UResult<()> {
1, 1,
get_message_with_args( get_message_with_args(
"stty-error-missing-argument", "stty-error-missing-argument",
HashMap::from([("arg".to_string(), arg.to_string())]), HashMap::from([("arg".to_string(), (*arg).to_string())]),
), ),
)); ));
} }
@ -433,7 +433,7 @@ fn stty(opts: &Options) -> UResult<()> {
1, 1,
get_message_with_args( get_message_with_args(
"stty-error-invalid-argument", "stty-error-invalid-argument",
HashMap::from([("arg".to_string(), arg.to_string())]), HashMap::from([("arg".to_string(), (*arg).to_string())]),
), ),
)); ));
} }
@ -540,7 +540,7 @@ fn print_terminal_size(termios: &Termios, opts: &Options) -> nix::Result<()> {
"{} ", "{} ",
get_message_with_args( get_message_with_args(
"stty-output-speed", "stty-output-speed",
HashMap::from([("speed".to_string(), text.to_string())]) HashMap::from([("speed".to_string(), (*text).to_string())])
) )
); );
break; break;