Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'crates/hir/src/semantics/source_to_def.rs')
| -rw-r--r-- | crates/hir/src/semantics/source_to_def.rs | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/crates/hir/src/semantics/source_to_def.rs b/crates/hir/src/semantics/source_to_def.rs index df8c1e904f..f60b3749b0 100644 --- a/crates/hir/src/semantics/source_to_def.rs +++ b/crates/hir/src/semantics/source_to_def.rs @@ -142,7 +142,7 @@ impl SourceToDefCtx<'_, '_> { Some(parent_declaration) => self.module_to_def(parent_declaration), None => { let file_id = src.file_id.original_file(self.db.upcast()); - self.file_to_def(file_id).get(0).copied() + self.file_to_def(file_id).first().copied() } }?; @@ -155,7 +155,7 @@ impl SourceToDefCtx<'_, '_> { pub(super) fn source_file_to_def(&self, src: InFile<ast::SourceFile>) -> Option<ModuleId> { let _p = profile::span("source_file_to_def"); let file_id = src.file_id.original_file(self.db.upcast()); - self.file_to_def(file_id).get(0).copied() + self.file_to_def(file_id).first().copied() } pub(super) fn trait_to_def(&mut self, src: InFile<ast::Trait>) -> Option<TraitId> { @@ -201,7 +201,7 @@ impl SourceToDefCtx<'_, '_> { &mut self, src: InFile<ast::Variant>, ) -> Option<EnumVariantId> { - self.to_def(src, keys::VARIANT) + self.to_def(src, keys::ENUM_VARIANT) } pub(super) fn extern_crate_to_def( &mut self, @@ -308,7 +308,7 @@ impl SourceToDefCtx<'_, '_> { pub(super) fn type_param_to_def(&mut self, src: InFile<ast::TypeParam>) -> Option<TypeParamId> { let container: ChildContainer = self.find_generic_param_container(src.syntax())?.into(); let dyn_map = self.cache_for(container, src.file_id); - dyn_map[keys::TYPE_PARAM].get(&src.value).copied().map(|it| TypeParamId::from_unchecked(it)) + dyn_map[keys::TYPE_PARAM].get(&src.value).copied().map(TypeParamId::from_unchecked) } pub(super) fn lifetime_param_to_def( @@ -326,10 +326,7 @@ impl SourceToDefCtx<'_, '_> { ) -> Option<ConstParamId> { let container: ChildContainer = self.find_generic_param_container(src.syntax())?.into(); let dyn_map = self.cache_for(container, src.file_id); - dyn_map[keys::CONST_PARAM] - .get(&src.value) - .copied() - .map(|it| ConstParamId::from_unchecked(it)) + dyn_map[keys::CONST_PARAM].get(&src.value).copied().map(ConstParamId::from_unchecked) } pub(super) fn generic_param_to_def( @@ -370,7 +367,7 @@ impl SourceToDefCtx<'_, '_> { } } - let def = self.file_to_def(src.file_id.original_file(self.db.upcast())).get(0).copied()?; + let def = self.file_to_def(src.file_id.original_file(self.db.upcast())).first().copied()?; Some(def.into()) } |