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
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue