Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir-def/src/item_scope.rs')
-rw-r--r--crates/hir-def/src/item_scope.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/crates/hir-def/src/item_scope.rs b/crates/hir-def/src/item_scope.rs
index 7721221c44..6753d61ef8 100644
--- a/crates/hir-def/src/item_scope.rs
+++ b/crates/hir-def/src/item_scope.rs
@@ -159,15 +159,14 @@ impl ItemScope {
pub(crate) fn name_of(&self, item: ItemInNs) -> Option<(&Name, Visibility)> {
let (def, mut iter) = match item {
ItemInNs::Macros(def) => {
- return self
- .macros
- .iter()
- .find_map(|(name, &(other_def, vis))| (other_def == def).then(|| (name, vis)));
+ return self.macros.iter().find_map(|(name, &(other_def, vis))| {
+ (other_def == def).then_some((name, vis))
+ });
}
ItemInNs::Types(def) => (def, self.types.iter()),
ItemInNs::Values(def) => (def, self.values.iter()),
};
- iter.find_map(|(name, &(other_def, vis))| (other_def == def).then(|| (name, vis)))
+ iter.find_map(|(name, &(other_def, vis))| (other_def == def).then_some((name, vis)))
}
pub(crate) fn traits<'a>(&'a self) -> impl Iterator<Item = TraitId> + 'a {