1
Fork 0

Rollup merge of #56119 - frewsxcv:frewsxcv-option-carrier, r=TimNN

Utilize `?` instead of `return None`.

None
This commit is contained in:
Pietro Albini 2018-12-05 23:54:25 +01:00 committed by GitHub
commit 64371f1cfe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 26 additions and 68 deletions

View file

@ -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())];