Closed
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");