Rollup merge of #79826 - LingMan:match_if, r=lcnr
Simplify visit_{foreign,trait}_item Using an `if` seems like a better semantic fit and saves a few lines. Noticed while looking at https://github.com/rust-lang/rust/pull/79752, but that's already merged. r? `@lcnr,` cc `@cjgillot` `@rustbot` modify labels +C-cleanup +T-compiler
This commit is contained in:
commit
9ced8dc0f5
1 changed files with 10 additions and 20 deletions
|
@ -423,36 +423,26 @@ impl<'v, 'k, 'tcx> ItemLikeVisitor<'v> for LifeSeeder<'k, 'tcx> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_trait_item(&mut self, trait_item: &hir::TraitItem<'_>) {
|
fn visit_trait_item(&mut self, trait_item: &hir::TraitItem<'_>) {
|
||||||
match trait_item.kind {
|
use hir::TraitItemKind::{Const, Fn};
|
||||||
hir::TraitItemKind::Const(_, Some(_))
|
if matches!(trait_item.kind, Const(_, Some(_)) | Fn(_, hir::TraitFn::Provided(_)))
|
||||||
| hir::TraitItemKind::Fn(_, hir::TraitFn::Provided(_)) => {
|
&& has_allow_dead_code_or_lang_attr(self.tcx, trait_item.hir_id, &trait_item.attrs)
|
||||||
if has_allow_dead_code_or_lang_attr(self.tcx, trait_item.hir_id, &trait_item.attrs)
|
|
||||||
{
|
{
|
||||||
self.worklist.push(trait_item.hir_id);
|
self.worklist.push(trait_item.hir_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn visit_impl_item(&mut self, _item: &hir::ImplItem<'_>) {
|
fn visit_impl_item(&mut self, _item: &hir::ImplItem<'_>) {
|
||||||
// ignore: we are handling this in `visit_item` above
|
// ignore: we are handling this in `visit_item` above
|
||||||
}
|
}
|
||||||
|
|
||||||
fn visit_foreign_item(&mut self, foreign_item: &hir::ForeignItem<'_>) {
|
fn visit_foreign_item(&mut self, foreign_item: &hir::ForeignItem<'_>) {
|
||||||
match foreign_item.kind {
|
use hir::ForeignItemKind::{Fn, Static};
|
||||||
hir::ForeignItemKind::Static(..) | hir::ForeignItemKind::Fn(..) => {
|
if matches!(foreign_item.kind, Static(..) | Fn(..))
|
||||||
if has_allow_dead_code_or_lang_attr(
|
&& has_allow_dead_code_or_lang_attr(self.tcx, foreign_item.hir_id, &foreign_item.attrs)
|
||||||
self.tcx,
|
{
|
||||||
foreign_item.hir_id,
|
|
||||||
&foreign_item.attrs,
|
|
||||||
) {
|
|
||||||
self.worklist.push(foreign_item.hir_id);
|
self.worklist.push(foreign_item.hir_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
_ => {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn create_and_seed_worklist<'tcx>(
|
fn create_and_seed_worklist<'tcx>(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue