]> git.lizzy.rs Git - rust.git/blob - tests/ui/unnecessary_join.rs
Auto merge of #9684 - kraktus:ref_option_ref, r=xFrednet
[rust.git] / tests / ui / unnecessary_join.rs
1 // run-rustfix
2 #![warn(clippy::unnecessary_join)]
3 #![allow(clippy::uninlined_format_args)]
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::<Vec<String>>()
12         .join("");
13     println!("{}", output);
14
15     // should be linted
16     let vector = vec!["hello", "world"];
17     let output = vector
18         .iter()
19         .map(|item| item.to_uppercase())
20         .collect::<Vec<_>>()
21         .join("");
22     println!("{}", output);
23
24     // should not be linted
25     let vector = vec!["hello", "world"];
26     let output = vector
27         .iter()
28         .map(|item| item.to_uppercase())
29         .collect::<Vec<String>>()
30         .join("\n");
31     println!("{}", output);
32
33     // should not be linted
34     let vector = vec!["hello", "world"];
35     let output = vector.iter().map(|item| item.to_uppercase()).collect::<String>();
36     println!("{}", output);
37 }