mirror of
https://github.com/rust-lang/rust-clippy
synced 2024-12-01 08:59:23 +00:00
38 lines
932 B
Rust
38 lines
932 B
Rust
|
// run-rustfix
|
||
|
|
||
|
#![warn(clippy::unnecessary_join)]
|
||
|
|
||
|
fn main() {
|
||
|
// should be linted
|
||
|
let vector = vec!["hello", "world"];
|
||
|
let output = vector
|
||
|
.iter()
|
||
|
.map(|item| item.to_uppercase())
|
||
|
.collect::<Vec<String>>()
|
||
|
.join("");
|
||
|
println!("{}", output);
|
||
|
|
||
|
// should be linted
|
||
|
let vector = vec!["hello", "world"];
|
||
|
let output = vector
|
||
|
.iter()
|
||
|
.map(|item| item.to_uppercase())
|
||
|
.collect::<Vec<_>>()
|
||
|
.join("");
|
||
|
println!("{}", output);
|
||
|
|
||
|
// should not be linted
|
||
|
let vector = vec!["hello", "world"];
|
||
|
let output = vector
|
||
|
.iter()
|
||
|
.map(|item| item.to_uppercase())
|
||
|
.collect::<Vec<String>>()
|
||
|
.join("\n");
|
||
|
println!("{}", output);
|
||
|
|
||
|
// should not be linted
|
||
|
let vector = vec!["hello", "world"];
|
||
|
let output = vector.iter().map(|item| item.to_uppercase()).collect::<String>();
|
||
|
println!("{}", output);
|
||
|
}
|