Missing PartialEq<&str> impls on Path and PathBuf #71700
Open
Description
Given that &OsStr
is comparable to &str
, I would expect &Path
(and PathBuf
) to be comparable to &str
since &OsStr
and &Path
can freely convert to each other.
Example
use std::path::{Path, PathBuf};
fn main() {
let path = PathBuf::from("-");
println!("{}", path == Path::new("-"));
println!("{}", path.as_os_str() == Path::new("-"));
println!("{}", path.as_os_str() == "-");
println!("{}", path == "-");
let path = Path::new("-");
println!("{}", path == PathBuf::from("-"));
println!("{}", path.as_os_str() == Path::new("-"));
println!("{}", path.as_os_str() == "-");
println!("{}", path == "-");
}