diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs index d846c0096011..fea243ba9703 100644 --- a/crates/ide/src/doc_links.rs +++ b/crates/ide/src/doc_links.rs @@ -69,7 +69,6 @@ pub fn rewrite_links(db: &RootDatabase, markdown: &str, definition: &Definition) // version of import map which follows the same process as rustdoc. Otherwise there'll always be some // edge cases where we select the wrong import path. fn get_doc_link(db: &RootDatabase, definition: Definition) -> Option { - eprintln!("enter"); // Get the outermost definition for the moduledef. This is used to resolve the public path to the type, // then we can join the method, field, etc onto it if required. let target_def: ModuleDef = match definition { @@ -84,7 +83,7 @@ fn get_doc_link(db: &RootDatabase, definition: Definition) -> Option { _ => return None, }; - let ns = ItemInNs::Types(target_def.clone().into()); + let ns = ItemInNs::from(target_def.clone()); let module = definition.module(db)?; let krate = module.krate(); @@ -110,7 +109,6 @@ fn get_doc_link(db: &RootDatabase, definition: Definition) -> Option { Definition::Field(field) => get_symbol_fragment(db, &FieldOrAssocItem::Field(field)), _ => None, }; - eprintln!("end-ish"); get_doc_url(db, &krate) .and_then(|url| url.join(&base).ok()) @@ -413,14 +411,13 @@ pub struct Fo<|>o; ); } - // TODO: Fix this test. Fails on `import_map.path_of(ns)` #[test] fn test_doc_url_fn() { check( r#" pub fn fo<|>o() {} "#, - expect![[r#""#]], + expect![[r##"https://docs.rs/test/*/test/fn.foo.html#method.foo"##]], ); } @@ -465,7 +462,6 @@ pub trait Foo { ); } - #[test] fn test_doc_url_field() { check(