-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Labels
C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messagesE-hardCall for participation: This a hard problem and requires more experience or effort to work onCall for participation: This a hard problem and requires more experience or effort to work onL-perfLint: Belongs in the perf lint groupLint: Belongs in the perf lint group
Description
use std::path::PathBuf;
fn main() {
let x = PathBuf::from("home");
let y = x.clone().join("matthias");
// join() creates a new owned pathbuf, does not take a &mut to x variable, thus the .clone() is redundant.(It also does not consume the PB)
println!("x: {:?}, y: {:?}", x, y);
// "x: "home", y: "home/matthias""
}
In this example let y = x.clone().join("matthias");
could just be let y = x.join("matthias");
phansch, sinkuu and tamaroning
Metadata
Metadata
Assignees
Labels
C-enhancementCategory: Enhancement of lints, like adding more cases or adding help messagesCategory: Enhancement of lints, like adding more cases or adding help messagesE-hardCall for participation: This a hard problem and requires more experience or effort to work onCall for participation: This a hard problem and requires more experience or effort to work onL-perfLint: Belongs in the perf lint groupLint: Belongs in the perf lint group