@@ -66,16 +66,14 @@ pub(crate) fn global_gcc_features(sess: &Session, diagnostics: bool) -> Vec<Stri
6666 // We do the equivalent above in `target_features_cfg`.
6767 // See <https://github.com/rust-lang/rust/issues/134792>.
6868 all_rust_features. push ( ( false , feature) ) ;
69- } else if !feature. is_empty ( ) {
70- if diagnostics {
71- sess. dcx ( ) . emit_warn ( UnknownCTargetFeaturePrefix { feature } ) ;
72- }
69+ } else if !feature. is_empty ( ) && diagnostics {
70+ sess. dcx ( ) . emit_warn ( UnknownCTargetFeaturePrefix { feature } ) ;
7371 }
7472 }
7573 // Remove features that are meant for rustc, not codegen.
76- all_rust_features. retain ( |( _, feature) | {
74+ all_rust_features. retain ( |& ( _, feature) | {
7775 // Retain if it is not a rustc feature
78- !RUSTC_SPECIFIC_FEATURES . contains ( feature)
76+ !RUSTC_SPECIFIC_FEATURES . contains ( & feature)
7977 } ) ;
8078
8179 // Check feature validity.
@@ -103,7 +101,7 @@ pub(crate) fn global_gcc_features(sess: &Session, diagnostics: bool) -> Vec<Stri
103101 } ;
104102 sess. dcx ( ) . emit_warn ( unknown_feature) ;
105103 }
106- Some ( ( _, stability, _) ) => {
104+ Some ( & ( _, stability, _) ) => {
107105 if let Err ( reason) = stability. toggle_allowed ( ) {
108106 sess. dcx ( ) . emit_warn ( ForbiddenCTargetFeature {
109107 feature,
@@ -165,29 +163,25 @@ pub(crate) fn global_gcc_features(sess: &Session, diagnostics: bool) -> Vec<Stri
165163 ) ;
166164
167165 // Translate this into GCC features.
168- let feats = all_rust_features
169- . iter ( )
170- . filter_map ( |& ( enable, feature) | {
166+ let feats =
167+ all_rust_features. iter ( ) . flat_map ( |& ( enable, feature) | {
171168 let enable_disable = if enable { '+' } else { '-' } ;
172169 // We run through `to_gcc_features` when
173170 // passing requests down to GCC. This means that all in-language
174171 // features also work on the command line instead of having two
175172 // different names when the GCC name and the Rust name differ.
176- Some (
177- to_gcc_features ( sess, feature)
178- . iter ( )
179- . flat_map ( |feat| to_gcc_features ( sess, feat) . into_iter ( ) )
180- . map ( |feature| {
181- if enable_disable == '-' {
182- format ! ( "-{}" , feature)
183- } else {
184- feature. to_string ( )
185- }
186- } )
187- . collect :: < Vec < _ > > ( ) ,
188- )
189- } )
190- . flatten ( ) ;
173+ to_gcc_features ( sess, feature)
174+ . iter ( )
175+ . flat_map ( |feat| to_gcc_features ( sess, feat) . into_iter ( ) )
176+ . map ( |feature| {
177+ if enable_disable == '-' {
178+ format ! ( "-{}" , feature)
179+ } else {
180+ feature. to_string ( )
181+ }
182+ } )
183+ . collect :: < Vec < _ > > ( )
184+ } ) ;
191185 features. extend ( feats) ;
192186
193187 if diagnostics {
0 commit comments