Skip to content

Commit 2f16b14

Browse files
authored
Merge pull request #8303 from nyurik/inefficient_to_string
chore: cleanup `inefficient_to_string` lint
2 parents b9a790b + db06c64 commit 2f16b14

File tree

6 files changed

+13
-14
lines changed

6 files changed

+13
-14
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -645,7 +645,6 @@ redundant_else = "allow" # 58
645645
map_unwrap_or = "allow" # 54
646646
cast_precision_loss = "allow" # 52
647647
unnested_or_patterns = "allow" # 40
648-
inefficient_to_string = "allow" # 38
649648
unnecessary_wraps = "allow" # 37
650649
cast_lossless = "allow" # 33
651650
ignored_unit_patterns = "allow" # 29

src/uu/head/src/parse.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ mod tests {
152152
}
153153

154154
fn obsolete_result(src: &[&str]) -> Option<Result<Vec<String>, ParseError>> {
155-
Some(Ok(src.iter().map(|s| s.to_string()).collect()))
155+
Some(Ok(src.iter().map(|s| (*s).to_string()).collect()))
156156
}
157157

158158
#[test]

src/uu/nohup/src/nohup.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ enum NohupError {
3838
#[error("{}", get_message("nohup-error-cannot-detach"))]
3939
CannotDetach,
4040

41-
#[error("{}", get_message_with_args("nohup-error-cannot-replace", HashMap::from([("name".to_string(), _0.to_string()), ("err".to_string(), _1.to_string())])))]
41+
#[error("{}", get_message_with_args("nohup-error-cannot-replace", HashMap::from([("name".to_string(), (*_0).to_string()), ("err".to_string(), _1.to_string())])))]
4242
CannotReplace(&'static str, #[source] Error),
4343

4444
#[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())])))]

src/uu/od/src/parse_formats.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -330,7 +330,7 @@ fn parse_type_string(params: &str) -> Result<Vec<ParsedFormatterItemInfo>, Strin
330330

331331
#[cfg(test)]
332332
pub fn parse_format_flags_str(args_str: &[&'static str]) -> Result<Vec<FormatterItemInfo>, String> {
333-
let args: Vec<String> = args_str.iter().map(|s| s.to_string()).collect();
333+
let args: Vec<String> = args_str.iter().map(|s| (*s).to_string()).collect();
334334
parse_format_flags(&args).map(|v| {
335335
// tests using this function assume add_ascii_dump is not set
336336
v.into_iter()

src/uu/ptx/src/ptx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@ enum PtxError {
198198
#[error("{}", get_message("ptx-error-dumb-format"))]
199199
DumbFormat,
200200

201-
#[error("{}", get_message_with_args("ptx-error-not-implemented", HashMap::from([("feature".to_string(), .0.to_string())])))]
201+
#[error("{}", get_message_with_args("ptx-error-not-implemented", HashMap::from([("feature".to_string(), (*.0).to_string())])))]
202202
NotImplemented(&'static str),
203203

204204
#[error("{0}")]

src/uu/stty/src/stty.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,7 @@ fn stty(opts: &Options) -> UResult<()> {
270270
1,
271271
get_message_with_args(
272272
"stty-error-missing-argument",
273-
HashMap::from([("arg".to_string(), arg.to_string())]),
273+
HashMap::from([("arg".to_string(), (*arg).to_string())]),
274274
),
275275
));
276276
}
@@ -286,8 +286,8 @@ fn stty(opts: &Options) -> UResult<()> {
286286
get_message_with_args(
287287
"stty-error-invalid-speed",
288288
HashMap::from([
289-
("arg".to_string(), arg.to_string()),
290-
("speed".to_string(), speed.to_string()),
289+
("arg".to_string(), (*arg).to_string()),
290+
("speed".to_string(), (*speed).to_string()),
291291
]),
292292
),
293293
));
@@ -298,7 +298,7 @@ fn stty(opts: &Options) -> UResult<()> {
298298
1,
299299
get_message_with_args(
300300
"stty-error-missing-argument",
301-
HashMap::from([("arg".to_string(), arg.to_string())]),
301+
HashMap::from([("arg".to_string(), (*arg).to_string())]),
302302
),
303303
));
304304
}
@@ -372,7 +372,7 @@ fn stty(opts: &Options) -> UResult<()> {
372372
1,
373373
get_message_with_args(
374374
"stty-error-invalid-argument",
375-
HashMap::from([("arg".to_string(), arg.to_string())]),
375+
HashMap::from([("arg".to_string(), (*arg).to_string())]),
376376
),
377377
));
378378
}
@@ -395,7 +395,7 @@ fn stty(opts: &Options) -> UResult<()> {
395395
1,
396396
get_message_with_args(
397397
"stty-error-missing-argument",
398-
HashMap::from([("arg".to_string(), arg.to_string())]),
398+
HashMap::from([("arg".to_string(), (*arg).to_string())]),
399399
),
400400
));
401401
}
@@ -417,7 +417,7 @@ fn stty(opts: &Options) -> UResult<()> {
417417
1,
418418
get_message_with_args(
419419
"stty-error-missing-argument",
420-
HashMap::from([("arg".to_string(), arg.to_string())]),
420+
HashMap::from([("arg".to_string(), (*arg).to_string())]),
421421
),
422422
));
423423
}
@@ -433,7 +433,7 @@ fn stty(opts: &Options) -> UResult<()> {
433433
1,
434434
get_message_with_args(
435435
"stty-error-invalid-argument",
436-
HashMap::from([("arg".to_string(), arg.to_string())]),
436+
HashMap::from([("arg".to_string(), (*arg).to_string())]),
437437
),
438438
));
439439
}
@@ -540,7 +540,7 @@ fn print_terminal_size(termios: &Termios, opts: &Options) -> nix::Result<()> {
540540
"{} ",
541541
get_message_with_args(
542542
"stty-output-speed",
543-
HashMap::from([("speed".to_string(), text.to_string())])
543+
HashMap::from([("speed".to_string(), (*text).to_string())])
544544
)
545545
);
546546
break;

0 commit comments

Comments
 (0)