Skip to content

Commit 8e10e4d

Browse files
committed
manual_map
manual implementation of `Option::map`
1 parent d6c9855 commit 8e10e4d

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

library/std/src/sys/windows/path.rs

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,10 @@ pub fn parse_prefix(path: &OsStr) -> Option<Prefix<'_>> {
147147
None
148148
}
149149
}
150-
} else if let Some(drive) = parse_drive(path) {
151-
// C:
152-
Some(Disk(drive))
153150
} else {
154-
// no prefix
155-
None
151+
// If it has a drive like `C:` then it's a disk.
152+
// Otherwise there is no prefix.
153+
parse_drive(path).map(Disk)
156154
}
157155
}
158156

0 commit comments

Comments
 (0)