1
1
use std:: collections:: BTreeMap ;
2
- use std:: path:: Path ;
3
2
4
- use rustc_ast:: ast;
5
3
use rustc_data_structures:: fx:: { FxHashMap , FxHashSet } ;
6
4
use rustc_middle:: ty:: TyCtxt ;
7
- use rustc_span:: symbol:: { sym , Symbol } ;
5
+ use rustc_span:: symbol:: Symbol ;
8
6
use serde:: ser:: { Serialize , SerializeStruct , Serializer } ;
9
7
10
8
use crate :: clean;
11
9
use crate :: clean:: types:: {
12
- AttributesExt , FnDecl , FnRetTy , GenericBound , Generics , GetDefId , Type , WherePredicate ,
10
+ FnDecl , FnRetTy , GenericBound , Generics , GetDefId , Type , WherePredicate ,
13
11
} ;
14
12
use crate :: formats:: cache:: Cache ;
15
13
use crate :: formats:: item_type:: ItemType ;
@@ -26,47 +24,6 @@ crate enum ExternalLocation {
26
24
Unknown ,
27
25
}
28
26
29
- /// Attempts to find where an external crate is located, given that we're
30
- /// rendering in to the specified source destination.
31
- crate fn extern_location (
32
- e : & clean:: ExternalCrate ,
33
- extern_url : Option < & str > ,
34
- ast_attrs : & [ ast:: Attribute ] ,
35
- dst : & Path ,
36
- tcx : TyCtxt < ' _ > ,
37
- ) -> ExternalLocation {
38
- use ExternalLocation :: * ;
39
- // See if there's documentation generated into the local directory
40
- let local_location = dst. join ( & * e. name ( tcx) . as_str ( ) ) ;
41
- if local_location. is_dir ( ) {
42
- return Local ;
43
- }
44
-
45
- if let Some ( url) = extern_url {
46
- let mut url = url. to_string ( ) ;
47
- if !url. ends_with ( '/' ) {
48
- url. push ( '/' ) ;
49
- }
50
- return Remote ( url) ;
51
- }
52
-
53
- // Failing that, see if there's an attribute specifying where to find this
54
- // external crate
55
- ast_attrs
56
- . lists ( sym:: doc)
57
- . filter ( |a| a. has_name ( sym:: html_root_url) )
58
- . filter_map ( |a| a. value_str ( ) )
59
- . map ( |url| {
60
- let mut url = url. to_string ( ) ;
61
- if !url. ends_with ( '/' ) {
62
- url. push ( '/' )
63
- }
64
- Remote ( url)
65
- } )
66
- . next ( )
67
- . unwrap_or ( Unknown ) // Well, at least we tried.
68
- }
69
-
70
27
/// Builds the search index from the collected metadata
71
28
crate fn build_index < ' tcx > ( krate : & clean:: Crate , cache : & mut Cache , tcx : TyCtxt < ' tcx > ) -> String {
72
29
let mut defid_to_pathid = FxHashMap :: default ( ) ;
0 commit comments