mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 06:11:35 +00:00
Changes from review
This commit is contained in:
parent
e4a787fcbc
commit
d2c68809ea
1 changed files with 3 additions and 3 deletions
|
@ -11,7 +11,7 @@ use ide_db::{defs::Definition, RootDatabase};
|
||||||
|
|
||||||
use hir::{
|
use hir::{
|
||||||
db::{DefDatabase, HirDatabase},
|
db::{DefDatabase, HirDatabase},
|
||||||
Adt, AsName, AssocItem, Crate, Field, HasAttrs, ItemInNs, MethodOwner, ModuleDef,
|
Adt, AsName, AssocItem, Crate, Field, HasAttrs, ItemInNs, MethodOwner, ModuleDef, AssocItemContainer, AsAssocItem
|
||||||
};
|
};
|
||||||
use ide_db::{
|
use ide_db::{
|
||||||
defs::{classify_name, classify_name_ref, Definition},
|
defs::{classify_name, classify_name_ref, Definition},
|
||||||
|
@ -219,7 +219,7 @@ fn rewrite_url_link(db: &RootDatabase, def: ModuleDef, target: &str) -> Option<S
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Retrieve a link to documentation for the given symbol.
|
/// Retrieve a link to documentation for the given symbol.
|
||||||
pub fn external_docs(db: &RootDatabase, position: &FilePosition) -> Option<DocumentationLink> {
|
pub(crate) fn external_docs(db: &RootDatabase, position: &FilePosition) -> Option<DocumentationLink> {
|
||||||
let sema = Semantics::new(db);
|
let sema = Semantics::new(db);
|
||||||
let file = sema.parse(position.file_id).syntax().clone();
|
let file = sema.parse(position.file_id).syntax().clone();
|
||||||
let token = pick_best(file.token_at_offset(position.offset))?;
|
let token = pick_best(file.token_at_offset(position.offset))?;
|
||||||
|
@ -401,7 +401,7 @@ fn get_symbol_fragment(db: &dyn HirDatabase, field_or_assoc: &FieldOrAssocItem)
|
||||||
FieldOrAssocItem::AssocItem(assoc) => match assoc {
|
FieldOrAssocItem::AssocItem(assoc) => match assoc {
|
||||||
AssocItem::Function(function) => {
|
AssocItem::Function(function) => {
|
||||||
let is_trait_method =
|
let is_trait_method =
|
||||||
matches!(function.method_owner(db), Some(MethodOwner::Trait(..)));
|
matches!(function.as_assoc_item(db).map(|assoc| assoc.container(db)), Some(AssocItemContainer::Trait(..)));
|
||||||
// This distinction may get more complicated when specialisation is available.
|
// This distinction may get more complicated when specialisation is available.
|
||||||
// Rustdoc makes this decision based on whether a method 'has defaultness'.
|
// Rustdoc makes this decision based on whether a method 'has defaultness'.
|
||||||
// Currently this is only the case for provided trait methods.
|
// Currently this is only the case for provided trait methods.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue