mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 11:59:49 +00:00
use Source for StructField
This commit is contained in:
parent
8b94b429e5
commit
178d8e96b5
5 changed files with 17 additions and 10 deletions
|
@ -168,9 +168,9 @@ impl NavigationTarget {
|
|||
}
|
||||
|
||||
pub(crate) fn from_field(db: &RootDatabase, field: hir::StructField) -> NavigationTarget {
|
||||
let (file_id, field) = field.source(db);
|
||||
let file_id = file_id.original_file(db);
|
||||
match field {
|
||||
let src = field.source(db);
|
||||
let file_id = src.file_id.original_file(db);
|
||||
match src.ast {
|
||||
FieldSource::Named(it) => {
|
||||
NavigationTarget::from_named(file_id, &*it, it.doc_comment_text(), it.short_label())
|
||||
}
|
||||
|
|
|
@ -102,8 +102,8 @@ pub(crate) fn hover(db: &RootDatabase, position: FilePosition) -> Option<RangeIn
|
|||
res.extend(hover_text(src.ast.doc_comment_text(), None));
|
||||
}
|
||||
Some(FieldAccess(it)) => {
|
||||
let it = it.source(db).1;
|
||||
if let hir::FieldSource::Named(it) = it {
|
||||
let src = it.source(db);
|
||||
if let hir::FieldSource::Named(it) = src.ast {
|
||||
res.extend(hover_text(it.doc_comment_text(), it.short_label()));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue