@@ -2163,19 +2163,20 @@ fn clean_use_statement(
21632163 return Vec :: new ( ) ;
21642164 }
21652165
2166- let doc_meta_item = import. attrs . lists ( sym:: doc) . get_word_attr ( sym:: inline) ;
2167- let please_inline = doc_meta_item. is_some ( ) ;
2166+ let inline_attr = import. attrs . lists ( sym:: doc) . get_word_attr ( sym:: inline) ;
21682167 let pub_underscore = import. vis . node . is_pub ( ) && name == kw:: Underscore ;
21692168
2170- if pub_underscore && please_inline {
2171- rustc_errors:: struct_span_err!(
2172- cx. tcx. sess,
2173- doc_meta_item. unwrap( ) . span( ) ,
2174- E0780 ,
2175- "anonymous imports cannot be inlined"
2176- )
2177- . span_label ( import. span , "anonymous import" )
2178- . emit ( ) ;
2169+ if pub_underscore {
2170+ if let Some ( ref inline) = inline_attr {
2171+ rustc_errors:: struct_span_err!(
2172+ cx. tcx. sess,
2173+ inline. span( ) ,
2174+ E0780 ,
2175+ "anonymous imports cannot be inlined"
2176+ )
2177+ . span_label ( import. span , "anonymous import" )
2178+ . emit ( ) ;
2179+ }
21792180 }
21802181
21812182 // We consider inlining the documentation of `pub use` statements, but we
@@ -2208,7 +2209,7 @@ fn clean_use_statement(
22082209 }
22092210 Import :: new_glob ( resolve_use_source ( cx, path) , true )
22102211 } else {
2211- if !please_inline {
2212+ if inline_attr . is_none ( ) {
22122213 if let Res :: Def ( DefKind :: Mod , did) = path. res {
22132214 if !did. is_local ( ) && did. index == CRATE_DEF_INDEX {
22142215 // if we're `pub use`ing an extern crate root, don't inline it unless we
0 commit comments