mirror of
https://github.com/cargo-bins/cargo-binstall.git
synced 2025-04-22 05:28:42 +00:00
Add a simple optimization to normalize_path
Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
parent
30b9a78520
commit
39ab334da5
1 changed files with 3 additions and 2 deletions
|
@ -30,9 +30,10 @@ impl PathExt for Path {
|
|||
}
|
||||
|
||||
let mut components = self.components().peekable();
|
||||
let mut ret = if let Some(c @ Component::Prefix(..)) = components.peek().cloned() {
|
||||
let mut ret = if let Some(c @ Component::Prefix(..)) = components.peek() {
|
||||
let buf = PathBuf::from(c.as_os_str());
|
||||
components.next();
|
||||
PathBuf::from(c.as_os_str())
|
||||
buf
|
||||
} else {
|
||||
PathBuf::new()
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue