use Source for statics and consts

This commit is contained in:
Aleksey Kladov 2019-06-11 17:13:20 +03:00
parent 4f94af3c4a
commit 46bc8675ed
6 changed files with 41 additions and 56 deletions

View file

@ -115,8 +115,8 @@ pub(crate) fn hover(db: &RootDatabase, position: FilePosition) -> Option<RangeIn
res.extend(hover_text(src.ast.doc_comment_text(), src.ast.short_label()))
}
hir::ImplItem::Const(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::TypeAlias(it) => {
let it = it.source(db).1;
@ -152,12 +152,12 @@ pub(crate) fn hover(db: &RootDatabase, position: FilePosition) -> Option<RangeIn
res.extend(hover_text(src.ast.doc_comment_text(), src.ast.short_label()))
}
hir::ModuleDef::Const(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::Static(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::Trait(it) => {
let it = it.source(db).1;