2 Checks for use of `.collect::<Vec<String>>().join("")` on iterators.
5 `.collect::<String>()` is more concise and might be more performant
9 let vector = vec!["hello", "world"];
10 let output = vector.iter().map(|item| item.to_uppercase()).collect::<Vec<String>>().join("");
11 println!("{}", output);
13 The correct use would be:
15 let vector = vec!["hello", "world"];
16 let output = vector.iter().map(|item| item.to_uppercase()).collect::<String>();
17 println!("{}", output);
20 While `.collect::<String>()` is sometimes more performant, there are cases where
21 using `.collect::<String>()` over `.collect::<Vec<String>>().join("")`
22 will prevent loop unrolling and will result in a negative performance impact.
24 Additionally, differences have been observed between aarch64 and x86_64 assembly output,
25 with aarch64 tending to producing faster assembly in more cases when using `.collect::<String>()`