@@ -3,8 +3,8 @@ use std::iter::once;
3
3
4
4
use hir:: {
5
5
db:: DefDatabase , Adt , AsAssocItem , AsName , AssocItemContainer , AttrDef , Crate , Documentation ,
6
- FieldSource , HasSource , HirDisplay , Hygiene , ItemInNs , ModPath , ModuleDef , ModuleSource ,
7
- Semantics , Module
6
+ FieldSource , HasSource , HirDisplay , Hygiene , ItemInNs , ModPath , Module , ModuleDef ,
7
+ ModuleSource , Semantics ,
8
8
} ;
9
9
use itertools:: Itertools ;
10
10
use lazy_static:: lazy_static;
@@ -16,9 +16,7 @@ use ra_ide_db::{
16
16
defs:: { classify_name, classify_name_ref, Definition } ,
17
17
RootDatabase ,
18
18
} ;
19
- use ra_syntax:: {
20
- ast, ast:: Path , match_ast, AstNode , SyntaxKind :: * , SyntaxToken , TokenAtOffset ,
21
- } ;
19
+ use ra_syntax:: { ast, ast:: Path , match_ast, AstNode , SyntaxKind :: * , SyntaxToken , TokenAtOffset } ;
22
20
use ra_tt:: { Ident , Leaf , Literal , TokenTree } ;
23
21
use url:: Url ;
24
22
@@ -441,8 +439,9 @@ fn rewrite_links(db: &RootDatabase, markdown: &str, definition: &Definition) ->
441
439
// Two posibilities:
442
440
// * path-based links: `../../module/struct.MyStruct.html`
443
441
// * module-based links (AKA intra-doc links): `super::super::module::MyStruct`
444
- let resolved = try_resolve_intra ( db, definition, title, & target)
445
- . or_else ( || try_resolve_path ( db, definition, & target) . map ( |target| ( target, title. to_string ( ) ) ) ) ;
442
+ let resolved = try_resolve_intra ( db, definition, title, & target) . or_else ( || {
443
+ try_resolve_path ( db, definition, & target) . map ( |target| ( target, title. to_string ( ) ) )
444
+ } ) ;
446
445
447
446
if let Some ( ( target, title) ) = resolved {
448
447
( target, title)
@@ -575,7 +574,8 @@ fn try_resolve_intra(
575
574
. join ( & get_symbol_filename ( db, & Definition :: ModuleDef ( def) ) ?)
576
575
. ok ( ) ?
577
576
. into_string ( ) ,
578
- strip_prefixes_suffixes ( link_text) . to_string ( ) ) )
577
+ strip_prefixes_suffixes ( link_text) . to_string ( ) ,
578
+ ) )
579
579
}
580
580
581
581
/// Try to resolve path to local documentation via path-based links (i.e. `../gateway/struct.Shard.html`).
0 commit comments