@@ -193,14 +193,12 @@ impl<'tcx> Context<'tcx> {
193
193
if it. is_stripped ( )
194
194
&& let Some ( def_id) = it. def_id ( )
195
195
&& def_id. is_local ( )
196
+ && ( self . info . is_inside_inlined_module
197
+ || self . shared . cache . inlined_items . contains ( & def_id) )
196
198
{
197
- if self . info . is_inside_inlined_module
198
- || self . shared . cache . inlined_items . contains ( & def_id)
199
- {
200
- // For now we're forced to generate a redirect page for stripped items until
201
- // `record_extern_fqn` correctly points to external items.
202
- render_redirect_pages = true ;
203
- }
199
+ // For now we're forced to generate a redirect page for stripped items until
200
+ // `record_extern_fqn` correctly points to external items.
201
+ render_redirect_pages = true ;
204
202
}
205
203
let mut title = String :: new ( ) ;
206
204
if !is_module {
@@ -254,40 +252,36 @@ impl<'tcx> Context<'tcx> {
254
252
& self . shared . style_files ,
255
253
)
256
254
} else {
257
- if let Some ( & ( ref names, ty) ) = self . cache ( ) . paths . get ( & it. item_id . expect_def_id ( ) ) {
258
- if self . current . len ( ) + 1 != names. len ( )
259
- || self . current . iter ( ) . zip ( names. iter ( ) ) . any ( |( a, b) | a != b)
260
- {
261
- // We checked that the redirection isn't pointing to the current file,
262
- // preventing an infinite redirection loop in the generated
263
- // documentation.
264
-
265
- let path = fmt:: from_fn ( |f| {
266
- for name in & names[ ..names. len ( ) - 1 ] {
267
- write ! ( f, "{name}/" ) ?;
268
- }
269
- write ! ( f, "{}" , print_item_path( ty, names. last( ) . unwrap( ) . as_str( ) ) )
270
- } ) ;
271
- match self . shared . redirections {
272
- Some ( ref redirections) => {
273
- let mut current_path = String :: new ( ) ;
274
- for name in & self . current {
275
- current_path. push_str ( name. as_str ( ) ) ;
276
- current_path. push ( '/' ) ;
277
- }
278
- let _ = write ! (
279
- current_path,
280
- "{}" ,
281
- print_item_path( ty, names. last( ) . unwrap( ) . as_str( ) )
282
- ) ;
283
- redirections. borrow_mut ( ) . insert ( current_path, path. to_string ( ) ) ;
284
- }
285
- None => {
286
- return layout:: redirect ( & format ! (
287
- "{root}{path}" ,
288
- root = self . root_path( )
289
- ) ) ;
255
+ if let Some ( & ( ref names, ty) ) = self . cache ( ) . paths . get ( & it. item_id . expect_def_id ( ) )
256
+ && ( self . current . len ( ) + 1 != names. len ( )
257
+ || self . current . iter ( ) . zip ( names. iter ( ) ) . any ( |( a, b) | a != b) )
258
+ {
259
+ // We checked that the redirection isn't pointing to the current file,
260
+ // preventing an infinite redirection loop in the generated
261
+ // documentation.
262
+
263
+ let path = fmt:: from_fn ( |f| {
264
+ for name in & names[ ..names. len ( ) - 1 ] {
265
+ write ! ( f, "{name}/" ) ?;
266
+ }
267
+ write ! ( f, "{}" , print_item_path( ty, names. last( ) . unwrap( ) . as_str( ) ) )
268
+ } ) ;
269
+ match self . shared . redirections {
270
+ Some ( ref redirections) => {
271
+ let mut current_path = String :: new ( ) ;
272
+ for name in & self . current {
273
+ current_path. push_str ( name. as_str ( ) ) ;
274
+ current_path. push ( '/' ) ;
290
275
}
276
+ let _ = write ! (
277
+ current_path,
278
+ "{}" ,
279
+ print_item_path( ty, names. last( ) . unwrap( ) . as_str( ) )
280
+ ) ;
281
+ redirections. borrow_mut ( ) . insert ( current_path, path. to_string ( ) ) ;
282
+ }
283
+ None => {
284
+ return layout:: redirect ( & format ! ( "{root}{path}" , root = self . root_path( ) ) ) ;
291
285
}
292
286
}
293
287
}
@@ -762,11 +756,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
762
756
// Flush pending errors.
763
757
self . shared . fs . close ( ) ;
764
758
let nb_errors = self . shared . errors . iter ( ) . map ( |err| self . tcx ( ) . dcx ( ) . err ( err) ) . count ( ) ;
765
- if nb_errors > 0 {
766
- Err ( Error :: new ( io:: Error :: new ( io:: ErrorKind :: Other , "I/O error" ) , "" ) )
767
- } else {
768
- Ok ( ( ) )
769
- }
759
+ if nb_errors > 0 { Err ( Error :: new ( io:: Error :: other ( "I/O error" ) , "" ) ) } else { Ok ( ( ) ) }
770
760
}
771
761
772
762
fn mod_item_in ( & mut self , item : & clean:: Item ) -> Result < ( ) , Error > {
@@ -842,7 +832,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
842
832
self . info . render_redirect_pages = item. is_stripped ( ) ;
843
833
}
844
834
845
- let buf = self . render_item ( & item, false ) ;
835
+ let buf = self . render_item ( item, false ) ;
846
836
// buf will be empty if the item is stripped and there is no redirect for it
847
837
if !buf. is_empty ( ) {
848
838
let name = item. name . as_ref ( ) . unwrap ( ) ;
@@ -853,7 +843,7 @@ impl<'tcx> FormatRenderer<'tcx> for Context<'tcx> {
853
843
self . shared . fs . write ( joint_dst, buf) ?;
854
844
855
845
if !self . info . render_redirect_pages {
856
- self . shared . all . borrow_mut ( ) . append ( full_path ( self , & item) , & item_type) ;
846
+ self . shared . all . borrow_mut ( ) . append ( full_path ( self , item) , & item_type) ;
857
847
}
858
848
// If the item is a macro, redirect from the old macro URL (with !)
859
849
// to the new one (without).
0 commit comments