mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
remove second way to get the body
This commit is contained in:
parent
03b2ab8e1f
commit
8fc08d36e3
2 changed files with 1 additions and 5 deletions
|
@ -77,10 +77,6 @@ impl Body {
|
||||||
pub fn pats(&self) -> impl Iterator<Item = (PatId, &Pat)> {
|
pub fn pats(&self) -> impl Iterator<Item = (PatId, &Pat)> {
|
||||||
self.pats.iter()
|
self.pats.iter()
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn source_map(&self, db: &impl HirDatabase) -> Arc<BodySourceMap> {
|
|
||||||
db.body_with_source_map(self.owner).1
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// needs arbitrary_self_types to be a method... or maybe move to the def?
|
// needs arbitrary_self_types to be a method... or maybe move to the def?
|
||||||
|
|
|
@ -109,7 +109,7 @@ pub(crate) fn reference_definition(
|
||||||
Some(Resolution::Def(def)) => return Exact(NavigationTarget::from_def(db, def)),
|
Some(Resolution::Def(def)) => return Exact(NavigationTarget::from_def(db, def)),
|
||||||
Some(Resolution::LocalBinding(pat)) => {
|
Some(Resolution::LocalBinding(pat)) => {
|
||||||
let body = resolver.body().expect("no body for local binding");
|
let body = resolver.body().expect("no body for local binding");
|
||||||
let source_map = body.source_map(db);
|
let source_map = body.owner().body_source_map(db);
|
||||||
let ptr = source_map.pat_syntax(pat).expect("pattern not found in syntax mapping");
|
let ptr = source_map.pat_syntax(pat).expect("pattern not found in syntax mapping");
|
||||||
let name =
|
let name =
|
||||||
path.as_ident().cloned().expect("local binding from a multi-segment path");
|
path.as_ident().cloned().expect("local binding from a multi-segment path");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue