@@ -15,7 +15,7 @@ use rustc::hir;
1515
1616use crate :: clean:: { self , PrimitiveType } ;
1717use crate :: html:: item_type:: ItemType ;
18- use crate :: html:: render:: { self , cache, CURRENT_LOCATION_KEY } ;
18+ use crate :: html:: render:: { self , cache, CURRENT_DEPTH } ;
1919
2020/// Helper to render an optional visibility with a space after it (if the
2121/// visibility is preset)
@@ -407,16 +407,16 @@ pub fn href(did: DefId) -> Option<(String, ItemType, Vec<String>)> {
407407 return None
408408 }
409409
410- let loc = CURRENT_LOCATION_KEY . with ( |l| l. borrow ( ) . clone ( ) ) ;
410+ let depth = CURRENT_DEPTH . with ( |l| l. get ( ) ) ;
411411 let ( fqp, shortty, mut url) = match cache. paths . get ( & did) {
412412 Some ( & ( ref fqp, shortty) ) => {
413- ( fqp, shortty, "../" . repeat ( loc . len ( ) ) )
413+ ( fqp, shortty, "../" . repeat ( depth ) )
414414 }
415415 None => {
416416 let & ( ref fqp, shortty) = cache. external_paths . get ( & did) ?;
417417 ( fqp, shortty, match cache. extern_locations [ & did. krate ] {
418418 ( .., render:: Remote ( ref s) ) => s. to_string ( ) ,
419- ( .., render:: Local ) => "../" . repeat ( loc . len ( ) ) ,
419+ ( .., render:: Local ) => "../" . repeat ( depth ) ,
420420 ( .., render:: Unknown ) => return None ,
421421 } )
422422 }
@@ -479,7 +479,7 @@ fn primitive_link(f: &mut fmt::Formatter<'_>,
479479 if !f. alternate ( ) {
480480 match m. primitive_locations . get ( & prim) {
481481 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 ( ) ) ;
483483 let len = if len == 0 { 0 } else { len - 1 } ;
484484 write ! ( f, "<a class=\" primitive\" href=\" {}primitive.{}.html\" >" ,
485485 "../" . repeat( len) ,
@@ -492,7 +492,7 @@ fn primitive_link(f: &mut fmt::Formatter<'_>,
492492 Some ( ( cname, s. to_string ( ) ) )
493493 }
494494 ( ref cname, _, render:: Local ) => {
495- let len = CURRENT_LOCATION_KEY . with ( |s| s. borrow ( ) . len ( ) ) ;
495+ let len = CURRENT_DEPTH . with ( |s| s. get ( ) ) ;
496496 Some ( ( cname, "../" . repeat ( len) ) )
497497 }
498498 ( .., render:: Unknown ) => None ,
0 commit comments