mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-03 15:15:24 +00:00
Rebase fixes
This commit is contained in:
parent
d2c68809ea
commit
8af1dd7337
2 changed files with 6 additions and 14 deletions
|
@ -35,7 +35,7 @@ use hir_ty::{
|
||||||
traits::SolutionVariables,
|
traits::SolutionVariables,
|
||||||
ApplicationTy, BoundVar, CallableDefId, Canonical, DebruijnIndex, FnSig, GenericPredicate,
|
ApplicationTy, BoundVar, CallableDefId, Canonical, DebruijnIndex, FnSig, GenericPredicate,
|
||||||
InEnvironment, Obligation, ProjectionPredicate, ProjectionTy, Substs, TraitEnvironment, Ty,
|
InEnvironment, Obligation, ProjectionPredicate, ProjectionTy, Substs, TraitEnvironment, Ty,
|
||||||
TyDefId, TyKind, TypeCtor, TyLoweringContext, TypeCtor,
|
TyDefId, TyKind, TypeCtor, TyLoweringContext,
|
||||||
};
|
};
|
||||||
use rustc_hash::FxHashSet;
|
use rustc_hash::FxHashSet;
|
||||||
use stdx::impl_from;
|
use stdx::impl_from;
|
||||||
|
|
|
@ -7,11 +7,9 @@ use pulldown_cmark_to_cmark::{cmark_with_options, Options as CmarkOptions};
|
||||||
use pulldown_cmark::{CowStr, Event, LinkType, Options, Parser, Tag};
|
use pulldown_cmark::{CowStr, Event, LinkType, Options, Parser, Tag};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
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, AssocItemContainer, AsAssocItem
|
Adt, AsName, AssocItem, Crate, Field, HasAttrs, ItemInNs, ModuleDef, AssocItemContainer, AsAssocItem
|
||||||
};
|
};
|
||||||
use ide_db::{
|
use ide_db::{
|
||||||
defs::{classify_name, classify_name_ref, Definition},
|
defs::{classify_name, classify_name_ref, Definition},
|
||||||
|
@ -95,12 +93,6 @@ pub fn remove_links(markdown: &str) -> String {
|
||||||
out
|
out
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_doc_link<T: Resolvable + Clone>(db: &dyn HirDatabase, definition: &T) -> Option<String> {
|
|
||||||
let module_def = definition.clone().try_into_module_def()?;
|
|
||||||
|
|
||||||
get_doc_link_impl(db, &module_def)
|
|
||||||
}
|
|
||||||
|
|
||||||
// FIXME:
|
// FIXME:
|
||||||
// BUG: For Option::Some
|
// BUG: For Option::Some
|
||||||
// Returns https://doc.rust-lang.org/nightly/core/prelude/v1/enum.Option.html#variant.Some
|
// Returns https://doc.rust-lang.org/nightly/core/prelude/v1/enum.Option.html#variant.Some
|
||||||
|
@ -129,8 +121,8 @@ fn get_doc_link(db: &RootDatabase, definition: Definition) -> Option<String> {
|
||||||
let module = definition.module(db)?;
|
let module = definition.module(db)?;
|
||||||
let krate = module.krate();
|
let krate = module.krate();
|
||||||
let import_map = db.import_map(krate.into());
|
let import_map = db.import_map(krate.into());
|
||||||
let base = once(krate.display_name(db)?)
|
let base = once(krate.declaration_name(db)?.to_string())
|
||||||
.chain(import_map.path_of(ns)?.segments.iter().map(|name| format!("{}", name)))
|
.chain(import_map.path_of(ns)?.segments.iter().map(|name| name.to_string()))
|
||||||
.join("/");
|
.join("/");
|
||||||
|
|
||||||
let filename = get_symbol_filename(db, &target_def);
|
let filename = get_symbol_filename(db, &target_def);
|
||||||
|
@ -433,10 +425,10 @@ fn pick_best(tokens: TokenAtOffset<SyntaxToken>) -> Option<SyntaxToken> {
|
||||||
mod tests {
|
mod tests {
|
||||||
use expect_test::{expect, Expect};
|
use expect_test::{expect, Expect};
|
||||||
|
|
||||||
use crate::mock_analysis::analysis_and_position;
|
use crate::fixture;
|
||||||
|
|
||||||
fn check(ra_fixture: &str, expect: Expect) {
|
fn check(ra_fixture: &str, expect: Expect) {
|
||||||
let (analysis, position) = analysis_and_position(ra_fixture);
|
let (analysis, position) = fixture::position(ra_fixture);
|
||||||
let url = analysis.external_docs(position).unwrap().expect("could not find url for symbol");
|
let url = analysis.external_docs(position).unwrap().expect("could not find url for symbol");
|
||||||
|
|
||||||
expect.assert_eq(&url)
|
expect.assert_eq(&url)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue