pub fn normalize_path<P>(path: P) -> PathBuf where
    P: AsRef<Path>, 
Expand description

Normalize all intermediate components of the path (ie. remove “./” and “../” components). Similar to fs::canonicalize() but doesn’t resolve symlinks.

Taken from Cargo https://github.com/rust-lang/cargo/blob/af307a38c20a753ec60f0ad18be5abed3db3c9ac/src/cargo/util/paths.rs#L60-L85