@@ -1343,12 +1343,12 @@ impl Context {
13431343 } else {
13441344 let mut url = repeat ( "../" ) . take ( cx. current . len ( ) )
13451345 . collect :: < String > ( ) ;
1346- if let Some ( & ( ref names, _ ) ) = cache ( ) . paths . get ( & it. def_id ) {
1346+ if let Some ( & ( ref names, ty ) ) = cache ( ) . paths . get ( & it. def_id ) {
13471347 for name in & names[ ..names. len ( ) - 1 ] {
13481348 url. push_str ( name) ;
13491349 url. push_str ( "/" ) ;
13501350 }
1351- url. push_str ( & item_path ( it ) ) ;
1351+ url. push_str ( & item_path ( ty , names . last ( ) . unwrap ( ) ) ) ;
13521352 layout:: redirect ( writer, & url) ?;
13531353 }
13541354 }
@@ -1409,7 +1409,8 @@ impl Context {
14091409 render ( & mut buf, self , & item, true ) . unwrap ( ) ;
14101410 // buf will be empty if the item is stripped and there is no redirect for it
14111411 if !buf. is_empty ( ) {
1412- let joint_dst = self . dst . join ( & item_path ( & item) ) ;
1412+ let joint_dst = self . dst . join ( & item_path ( shortty ( & item) ,
1413+ item. name . as_ref ( ) . unwrap ( ) ) ) ;
14131414 try_err ! ( fs:: create_dir_all( & self . dst) , & self . dst) ;
14141415 let mut dst = try_err ! ( File :: create( & joint_dst) , & joint_dst) ;
14151416 try_err ! ( dst. write_all( & buf) , & joint_dst) ;
@@ -1531,7 +1532,7 @@ impl<'a> Item<'a> {
15311532 Some ( format ! ( "{root}{path}/{file}?gotosrc={goto}" ,
15321533 root = root,
15331534 path = path[ ..path. len( ) - 1 ] . join( "/" ) ,
1534- file = item_path( self . item) ,
1535+ file = item_path( shortty ( self . item) , self . item . name . as_ref ( ) . unwrap ( ) ) ,
15351536 goto = self . item. def_id. index. as_usize( ) ) )
15361537 }
15371538 }
@@ -1623,13 +1624,10 @@ impl<'a> fmt::Display for Item<'a> {
16231624 }
16241625}
16251626
1626- fn item_path ( item : & clean:: Item ) -> String {
1627- if item. is_mod ( ) {
1628- format ! ( "{}/index.html" , item. name. as_ref( ) . unwrap( ) )
1629- } else {
1630- format ! ( "{}.{}.html" ,
1631- shortty( item) . to_static_str( ) ,
1632- * item. name. as_ref( ) . unwrap( ) )
1627+ fn item_path ( ty : ItemType , name : & str ) -> String {
1628+ match ty {
1629+ ItemType :: Module => format ! ( "{}/index.html" , name) ,
1630+ _ => format ! ( "{}.{}.html" , ty. to_static_str( ) , name) ,
16331631 }
16341632}
16351633
@@ -1821,7 +1819,7 @@ fn item_module(w: &mut fmt::Formatter, cx: &Context,
18211819 docs = shorter( Some ( & Markdown ( doc_value) . to_string( ) ) ) ,
18221820 class = shortty( myitem) ,
18231821 stab = myitem. stability_class( ) ,
1824- href = item_path( myitem) ,
1822+ href = item_path( shortty ( myitem) , myitem . name . as_ref ( ) . unwrap ( ) ) ,
18251823 title = full_path( cx, myitem) ) ?;
18261824 }
18271825 }
0 commit comments