diff options
| author | Pietro Albini <pietro@pietroalbini.org> | 2018-12-05 23:54:25 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2018-12-05 23:54:25 +0100 |
| commit | 64371f1cfee8d5ec8552ac8ee4cbdb4cd2629b91 (patch) | |
| tree | 87bdf3cb911fbad454292ca3383bfa6f772f3c5c /src/libstd/sys/windows | |
| parent | 1594a4245ba9951039bb39bf5e3484605ab5d068 (diff) | |
| parent | 9012af6f19d999869824e3b933de5f7b30986877 (diff) | |
| download | rust-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.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())]; |
