@@ -112,7 +112,6 @@ pub fn get_doc_link<T: Resolvable + Clone>(db: &dyn HirDatabase, definition: &T)
112112// version of import map which follows the same process as rustdoc. Otherwise there'll always be some
113113// edge cases where we select the wrong import path.
114114fn get_doc_link ( db : & RootDatabase , definition : Definition ) -> Option < String > {
115- eprintln ! ( "enter" ) ;
116115 // Get the outermost definition for the moduledef. This is used to resolve the public path to the type,
117116 // then we can join the method, field, etc onto it if required.
118117 let target_def: ModuleDef = match definition {
@@ -127,7 +126,7 @@ fn get_doc_link(db: &RootDatabase, definition: Definition) -> Option<String> {
127126 _ => return None ,
128127 } ;
129128
130- let ns = ItemInNs :: Types ( target_def. clone ( ) . into ( ) ) ;
129+ let ns = ItemInNs :: from ( target_def. clone ( ) ) ;
131130
132131 let module = definition. module ( db) ?;
133132 let krate = module. krate ( ) ;
@@ -153,7 +152,6 @@ fn get_doc_link(db: &RootDatabase, definition: Definition) -> Option<String> {
153152 Definition :: Field ( field) => get_symbol_fragment ( db, & FieldOrAssocItem :: Field ( field) ) ,
154153 _ => None ,
155154 } ;
156- eprintln ! ( "end-ish" ) ;
157155
158156 get_doc_url ( db, & krate)
159157 . and_then ( |url| url. join ( & base) . ok ( ) )
@@ -456,14 +454,13 @@ pub struct Fo<|>o;
456454 ) ;
457455 }
458456
459- // TODO: Fix this test. Fails on `import_map.path_of(ns)`
460457 #[ test]
461458 fn test_doc_url_fn ( ) {
462459 check (
463460 r#"
464461pub fn fo<|>o() {}
465462"# ,
466- expect ! [ [ r#"" # ] ] ,
463+ expect ! [ [ r##"https://docs.rs/test/*/test/fn.foo.html#method.foo"# # ] ] ,
467464 ) ;
468465 }
469466
@@ -508,7 +505,6 @@ pub trait Foo {
508505 ) ;
509506 }
510507
511-
512508 #[ test]
513509 fn test_doc_url_field ( ) {
514510 check (
0 commit comments