Skip to content

Commit

Permalink
#50: Resolve a new Clippy lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mtkennerly committed Nov 21, 2020
1 parent 9bcd06c commit 9e84355
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -196,15 +196,15 @@ impl StrictPath {
pub fn split_drive(&self) -> (String, String) {
let interpreted = self.interpret();

if interpreted.starts_with(UNC_LOCAL_PREFIX) {
if let Some(stripped) = interpreted.strip_prefix(UNC_LOCAL_PREFIX) {
// Local UNC path - simplify to a classic drive for user-friendliness:
let split: Vec<_> = interpreted[UNC_LOCAL_PREFIX.len()..].splitn(2, '\\').collect();
let split: Vec<_> = stripped.splitn(2, '\\').collect();
if split.len() == 2 {
return (split[0].to_owned(), split[1].replace("\\", "/"));
}
} else if interpreted.starts_with(UNC_PREFIX) {
} else if let Some(stripped) = interpreted.strip_prefix(UNC_PREFIX) {
// Remote UNC path - can't simplify to classic drive:
let split: Vec<_> = interpreted[UNC_PREFIX.len()..].splitn(2, '\\').collect();
let split: Vec<_> = stripped.splitn(2, '\\').collect();
if split.len() == 2 {
return (format!("{}{}", UNC_PREFIX, split[0]), split[1].replace("\\", "/"));
}
Expand Down

0 comments on commit 9e84355

Please sign in to comment.