diff --git a/src/helpers/path_ext.rs b/src/helpers/path_ext.rs index bf223280..78f26687 100644 --- a/src/helpers/path_ext.rs +++ b/src/helpers/path_ext.rs @@ -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() };