Adopt let else in more places
This commit is contained in:
parent
b8c56fa8c3
commit
2ef8af6619
132 changed files with 539 additions and 881 deletions
|
@ -108,11 +108,9 @@ impl<'a> CollectProcMacros<'a> {
|
|||
}
|
||||
|
||||
fn collect_custom_derive(&mut self, item: &'a ast::Item, attr: &'a ast::Attribute) {
|
||||
let (trait_name, proc_attrs) =
|
||||
match parse_macro_name_and_helper_attrs(self.handler, attr, "derive") {
|
||||
Some(name_and_attrs) => name_and_attrs,
|
||||
None => return,
|
||||
};
|
||||
let Some((trait_name, proc_attrs)) = parse_macro_name_and_helper_attrs(self.handler, attr, "derive") else {
|
||||
return;
|
||||
};
|
||||
|
||||
if self.in_root && item.vis.kind.is_pub() {
|
||||
self.macros.push(ProcMacro::Derive(ProcMacroDerive {
|
||||
|
@ -224,15 +222,12 @@ impl<'a> Visitor<'a> for CollectProcMacros<'a> {
|
|||
}
|
||||
}
|
||||
|
||||
let attr = match found_attr {
|
||||
None => {
|
||||
self.check_not_pub_in_root(&item.vis, self.source_map.guess_head_span(item.span));
|
||||
let prev_in_root = mem::replace(&mut self.in_root, false);
|
||||
visit::walk_item(self, item);
|
||||
self.in_root = prev_in_root;
|
||||
return;
|
||||
}
|
||||
Some(attr) => attr,
|
||||
let Some(attr) = found_attr else {
|
||||
self.check_not_pub_in_root(&item.vis, self.source_map.guess_head_span(item.span));
|
||||
let prev_in_root = mem::replace(&mut self.in_root, false);
|
||||
visit::walk_item(self, item);
|
||||
self.in_root = prev_in_root;
|
||||
return;
|
||||
};
|
||||
|
||||
if !is_fn {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue