@@ -15,7 +15,7 @@ use rustc::hir;
15
15
16
16
use crate :: clean:: { self , PrimitiveType } ;
17
17
use crate :: html:: item_type:: ItemType ;
18
- use crate :: html:: render:: { self , cache, CURRENT_LOCATION_KEY } ;
18
+ use crate :: html:: render:: { self , cache, CURRENT_DEPTH } ;
19
19
20
20
/// Helper to render an optional visibility with a space after it (if the
21
21
/// visibility is preset)
@@ -407,16 +407,16 @@ pub fn href(did: DefId) -> Option<(String, ItemType, Vec<String>)> {
407
407
return None
408
408
}
409
409
410
- let loc = CURRENT_LOCATION_KEY . with ( |l| l. borrow ( ) . clone ( ) ) ;
410
+ let depth = CURRENT_DEPTH . with ( |l| l. get ( ) ) ;
411
411
let ( fqp, shortty, mut url) = match cache. paths . get ( & did) {
412
412
Some ( & ( ref fqp, shortty) ) => {
413
- ( fqp, shortty, "../" . repeat ( loc . len ( ) ) )
413
+ ( fqp, shortty, "../" . repeat ( depth ) )
414
414
}
415
415
None => {
416
416
let & ( ref fqp, shortty) = cache. external_paths . get ( & did) ?;
417
417
( fqp, shortty, match cache. extern_locations [ & did. krate ] {
418
418
( .., render:: Remote ( ref s) ) => s. to_string ( ) ,
419
- ( .., render:: Local ) => "../" . repeat ( loc . len ( ) ) ,
419
+ ( .., render:: Local ) => "../" . repeat ( depth ) ,
420
420
( .., render:: Unknown ) => return None ,
421
421
} )
422
422
}
@@ -479,7 +479,7 @@ fn primitive_link(f: &mut fmt::Formatter<'_>,
479
479
if !f. alternate ( ) {
480
480
match m. primitive_locations . get ( & prim) {
481
481
Some ( & def_id) if def_id. is_local ( ) => {
482
- let len = CURRENT_LOCATION_KEY . with ( |s| s. borrow ( ) . len ( ) ) ;
482
+ let len = CURRENT_DEPTH . with ( |s| s. get ( ) ) ;
483
483
let len = if len == 0 { 0 } else { len - 1 } ;
484
484
write ! ( f, "<a class=\" primitive\" href=\" {}primitive.{}.html\" >" ,
485
485
"../" . repeat( len) ,
@@ -492,7 +492,7 @@ fn primitive_link(f: &mut fmt::Formatter<'_>,
492
492
Some ( ( cname, s. to_string ( ) ) )
493
493
}
494
494
( ref cname, _, render:: Local ) => {
495
- let len = CURRENT_LOCATION_KEY . with ( |s| s. borrow ( ) . len ( ) ) ;
495
+ let len = CURRENT_DEPTH . with ( |s| s. get ( ) ) ;
496
496
Some ( ( cname, "../" . repeat ( len) ) )
497
497
}
498
498
( .., render:: Unknown ) => None ,
0 commit comments