]> git.lizzy.rs Git - rust.git/blob - src/tools/clippy/tests/ui/unnecessary_join.fixed
Auto merge of #97944 - nikic:freebsd-update, r=Mark-Simulacrum
[rust.git] / src / tools / clippy / tests / ui / unnecessary_join.fixed
1 // run-rustfix
2
3 #![warn(clippy::unnecessary_join)]
4
5 fn main() {
6     // should be linted
7     let vector = vec!["hello", "world"];
8     let output = vector
9         .iter()
10         .map(|item| item.to_uppercase())
11         .collect::<String>();
12     println!("{}", output);
13
14     // should be linted
15     let vector = vec!["hello", "world"];
16     let output = vector
17         .iter()
18         .map(|item| item.to_uppercase())
19         .collect::<String>();
20     println!("{}", output);
21
22     // should not be linted
23     let vector = vec!["hello", "world"];
24     let output = vector
25         .iter()
26         .map(|item| item.to_uppercase())
27         .collect::<Vec<String>>()
28         .join("\n");
29     println!("{}", output);
30
31     // should not be linted
32     let vector = vec!["hello", "world"];
33     let output = vector.iter().map(|item| item.to_uppercase()).collect::<String>();
34     println!("{}", output);
35 }