From 0d9f97166ba546ceaded21dc62450859d3dc9f92 Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sun, 18 Sep 2022 19:44:38 +0200 Subject: [PATCH] Simplify --- crates/hir-def/src/item_scope.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/hir-def/src/item_scope.rs b/crates/hir-def/src/item_scope.rs index a40656fd6a42b..7721221c44475 100644 --- a/crates/hir-def/src/item_scope.rs +++ b/crates/hir-def/src/item_scope.rs @@ -18,7 +18,7 @@ use crate::{ ConstId, HasModule, ImplId, LocalModuleId, MacroId, ModuleDefId, ModuleId, TraitId, }; -#[derive(Copy, Clone)] +#[derive(Copy, Clone, Debug)] pub(crate) enum ImportType { Glob, Named, @@ -302,13 +302,13 @@ impl ItemScope { $changed = true; } Entry::Occupied(mut entry) - if $glob_imports.$field.contains(&$lookup) - && matches!($def_import_type, ImportType::Named) => + if matches!($def_import_type, ImportType::Named) => { - cov_mark::hit!(import_shadowed); - $glob_imports.$field.remove(&$lookup); - entry.insert(fld); - $changed = true; + if $glob_imports.$field.remove(&$lookup) { + cov_mark::hit!(import_shadowed); + entry.insert(fld); + $changed = true; + } } _ => {} }