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

@ -3948,10 +3948,7 @@ pub fn path_to_def_local(tcx: &TyCtxt, path: &[&str]) -> Option<DefId> {
let mut path_it = path.iter().peekable();
loop {
let segment = match path_it.next() {
Some(segment) => segment,
None => return None,
};
let segment = path_it.next()?;
for item_id in mem::replace(&mut items, HirVec::new()).iter() {
let item = tcx.hir.expect_item(item_id.id);
@ -3986,10 +3983,7 @@ pub fn path_to_def(tcx: &TyCtxt, path: &[&str]) -> Option<DefId> {
let mut path_it = path.iter().skip(1).peekable();
loop {
let segment = match path_it.next() {
Some(segment) => segment,
None => return None,
};
let segment = path_it.next()?;
for item in mem::replace(&mut items, Lrc::new(vec![])).iter() {
if item.ident.name == *segment {