@@ -2163,19 +2163,20 @@ fn clean_use_statement(
2163
2163
return Vec :: new ( ) ;
2164
2164
}
2165
2165
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) ;
2168
2167
let pub_underscore = import. vis . node . is_pub ( ) && name == kw:: Underscore ;
2169
2168
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
+ }
2179
2180
}
2180
2181
2181
2182
// We consider inlining the documentation of `pub use` statements, but we
@@ -2208,7 +2209,7 @@ fn clean_use_statement(
2208
2209
}
2209
2210
Import :: new_glob ( resolve_use_source ( cx, path) , true )
2210
2211
} else {
2211
- if !please_inline {
2212
+ if inline_attr . is_none ( ) {
2212
2213
if let Res :: Def ( DefKind :: Mod , did) = path. res {
2213
2214
if !did. is_local ( ) && did. index == CRATE_DEF_INDEX {
2214
2215
// if we're `pub use`ing an extern crate root, don't inline it unless we
0 commit comments