Closed
Description
let mut x = PathBuf::from("/foo");
x.push("/bar");
println!("x: {}", x.display()); // "/bar"
I just ran into a situation where I did something like this, and it resulted in the path being
/bar
instead of wanted /foo/bar
.
What I actually wanted was
x.push("bar");
so that the path becomes /foo/bar
Could we warn about pushing an element to a pathbuf that has the file system root in it, or something like this