diff options
| author | Corey Farwell <coreyf@rwell.org> | 2018-11-20 23:01:56 -0500 |
|---|---|---|
| committer | Corey Farwell <coreyf@rwell.org> | 2018-12-04 08:57:34 -0800 |
| commit | 9012af6f19d999869824e3b933de5f7b30986877 (patch) | |
| tree | ee9f72b4221183f09d30b7fa1c5e4ef6d87e5d1c /src/libstd | |
| parent | f32f1113c93fe84f252293ae4af86be1ceae4a84 (diff) | |
| download | rust-9012af6f19d999869824e3b933de5f7b30986877.tar.gz rust-9012af6f19d999869824e3b933de5f7b30986877.zip | |
Utilize `?` instead of `return None`.
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/sys/windows/path.rs | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/libstd/sys/windows/path.rs b/src/libstd/sys/windows/path.rs index 98d62a0c953..ff910a50226 100644 --- a/src/libstd/sys/windows/path.rs +++ b/src/libstd/sys/windows/path.rs @@ -91,10 +91,7 @@ pub fn parse_prefix<'a>(path: &'a OsStr) -> Option<Prefix> { } fn parse_two_comps(mut path: &[u8], f: fn(u8) -> bool) -> Option<(&[u8], &[u8])> { - let first = match path.iter().position(|x| f(*x)) { - None => return None, - Some(x) => &path[..x], - }; + let first = &path[..path.iter().position(|x| f(*x))?]; path = &path[(first.len() + 1)..]; let idx = path.iter().position(|x| f(*x)); let second = &path[..idx.unwrap_or(path.len())]; |
