use Source for Function

This commit is contained in:
Aleksey Kladov 2019-06-11 16:49:56 +03:00
parent 36865adcb9
commit 4f94af3c4a
10 changed files with 30 additions and 28 deletions

View file

@ -96,8 +96,8 @@ pub(crate) fn hover(db: &RootDatabase, position: FilePosition) -> Option<RangeIn
match classify_name_ref(db, &analyzer, name_ref) {
Some(Method(it)) => {
let it = it.source(db).1;
res.extend(hover_text(it.doc_comment_text(), it.short_label()));
let src = it.source(db);
res.extend(hover_text(src.ast.doc_comment_text(), src.ast.short_label()));
}
Some(Macro(it)) => {
let it = it.source(db).1;
@ -111,8 +111,8 @@ pub(crate) fn hover(db: &RootDatabase, position: FilePosition) -> Option<RangeIn
}
Some(AssocItem(it)) => match it {
hir::ImplItem::Method(it) => {
let it = it.source(db).1;
res.extend(hover_text(it.doc_comment_text(), it.short_label()))
let src = it.source(db);
res.extend(hover_text(src.ast.doc_comment_text(), src.ast.short_label()))
}
hir::ImplItem::Const(it) => {
let it = it.source(db).1;
@ -132,8 +132,8 @@ pub(crate) fn hover(db: &RootDatabase, position: FilePosition) -> Option<RangeIn
}
}
hir::ModuleDef::Function(it) => {
let it = it.source(db).1;
res.extend(hover_text(it.doc_comment_text(), it.short_label()))
let src = it.source(db);
res.extend(hover_text(src.ast.doc_comment_text(), src.ast.short_label()))
}
hir::ModuleDef::Struct(it) => {
let src = it.source(db);