@@ -112,7 +112,6 @@ pub fn get_doc_link<T: Resolvable + Clone>(db: &dyn HirDatabase, definition: &T)
112
112
// version of import map which follows the same process as rustdoc. Otherwise there'll always be some
113
113
// edge cases where we select the wrong import path.
114
114
fn get_doc_link ( db : & RootDatabase , definition : Definition ) -> Option < String > {
115
- eprintln ! ( "enter" ) ;
116
115
// Get the outermost definition for the moduledef. This is used to resolve the public path to the type,
117
116
// then we can join the method, field, etc onto it if required.
118
117
let target_def: ModuleDef = match definition {
@@ -127,7 +126,7 @@ fn get_doc_link(db: &RootDatabase, definition: Definition) -> Option<String> {
127
126
_ => return None ,
128
127
} ;
129
128
130
- let ns = ItemInNs :: Types ( target_def. clone ( ) . into ( ) ) ;
129
+ let ns = ItemInNs :: from ( target_def. clone ( ) ) ;
131
130
132
131
let module = definition. module ( db) ?;
133
132
let krate = module. krate ( ) ;
@@ -153,7 +152,6 @@ fn get_doc_link(db: &RootDatabase, definition: Definition) -> Option<String> {
153
152
Definition :: Field ( field) => get_symbol_fragment ( db, & FieldOrAssocItem :: Field ( field) ) ,
154
153
_ => None ,
155
154
} ;
156
- eprintln ! ( "end-ish" ) ;
157
155
158
156
get_doc_url ( db, & krate)
159
157
. and_then ( |url| url. join ( & base) . ok ( ) )
@@ -456,14 +454,13 @@ pub struct Fo<|>o;
456
454
) ;
457
455
}
458
456
459
- // TODO: Fix this test. Fails on `import_map.path_of(ns)`
460
457
#[ test]
461
458
fn test_doc_url_fn ( ) {
462
459
check (
463
460
r#"
464
461
pub fn fo<|>o() {}
465
462
"# ,
466
- expect ! [ [ r#"" # ] ] ,
463
+ expect ! [ [ r##"https://docs.rs/test/*/test/fn.foo.html#method.foo"# # ] ] ,
467
464
) ;
468
465
}
469
466
@@ -508,7 +505,6 @@ pub trait Foo {
508
505
) ;
509
506
}
510
507
511
-
512
508
#[ test]
513
509
fn test_doc_url_field ( ) {
514
510
check (
0 commit comments