about summary refs log tree commit diff
path: root/src/libstd/sys/windows
diff options
context:
space:
mode:
authorPietro Albini <pietro@pietroalbini.org>2018-12-05 23:54:25 +0100
committerGitHub <noreply@github.com>2018-12-05 23:54:25 +0100
commit64371f1cfee8d5ec8552ac8ee4cbdb4cd2629b91 (patch)
tree87bdf3cb911fbad454292ca3383bfa6f772f3c5c /src/libstd/sys/windows
parent1594a4245ba9951039bb39bf5e3484605ab5d068 (diff)
parent9012af6f19d999869824e3b933de5f7b30986877 (diff)
downloadrust-64371f1cfee8d5ec8552ac8ee4cbdb4cd2629b91.tar.gz
rust-64371f1cfee8d5ec8552ac8ee4cbdb4cd2629b91.zip
Rollup merge of #56119 - frewsxcv:frewsxcv-option-carrier, r=TimNN
Utilize `?` instead of `return None`.

None
Diffstat (limited to 'src/libstd/sys/windows')
-rw-r--r--src/libstd/sys/windows/path.rs5
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())];