Rollup merge of #56119 - frewsxcv:frewsxcv-option-carrier, r=TimNN
Utilize `?` instead of `return None`. None
This commit is contained in:
commit
64371f1cfe
12 changed files with 26 additions and 68 deletions
|
@ -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())];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue