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.rs12
1 files changed, 3 insertions, 9 deletions
diff --git a/crates/hir/src/semantics/source_to_def.rs b/crates/hir/src/semantics/source_to_def.rs
index 4733ea5a35..d4d6f0b243 100644
--- a/crates/hir/src/semantics/source_to_def.rs
+++ b/crates/hir/src/semantics/source_to_def.rs
@@ -101,7 +101,7 @@ use hir_def::{
use hir_expand::{attrs::AttrId, name::AsName, HirFileId, HirFileIdExt, MacroCallId};
use rustc_hash::FxHashMap;
use smallvec::SmallVec;
-use stdx::{impl_from, never};
+use stdx::impl_from;
use syntax::{
ast::{self, HasName},
AstNode, SyntaxNode,
@@ -253,14 +253,8 @@ impl SourceToDefCtx<'_, '_> {
src: InFile<ast::SelfParam>,
) -> Option<(DefWithBodyId, BindingId)> {
let container = self.find_pat_or_label_container(src.syntax())?;
- let (body, source_map) = self.db.body_with_source_map(container);
- let pat_id = source_map.node_self_param(src.as_ref())?;
- if let crate::Pat::Bind { id, .. } = body[pat_id] {
- Some((container, id))
- } else {
- never!();
- None
- }
+ let body = self.db.body(container);
+ Some((container, body.self_param?))
}
pub(super) fn label_to_def(
&mut self,