manual_map

manual implementation of `Option::map`
This commit is contained in:
Chris Denton 2023-11-21 23:55:07 +00:00
parent 8c85c5b7f4
commit 4c084c576a
No known key found for this signature in database
GPG Key ID: 713472F2F45627DE

View File

@ -147,12 +147,10 @@ pub fn parse_prefix(path: &OsStr) -> Option<Prefix<'_>> {
None
}
}
} else if let Some(drive) = parse_drive(path) {
// C:
Some(Disk(drive))
} else {
// no prefix
None
// If it has a drive like `C:` then it's a disk.
// Otherwise there is no prefix.
parse_drive(path).map(Disk)
}
}