@@ -66,16 +66,14 @@ pub(crate) fn global_gcc_features(sess: &Session, diagnostics: bool) -> Vec<Stri
66
66
// We do the equivalent above in `target_features_cfg`.
67
67
// See <https://github.com/rust-lang/rust/issues/134792>.
68
68
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 } ) ;
73
71
}
74
72
}
75
73
// Remove features that are meant for rustc, not codegen.
76
- all_rust_features. retain ( |( _, feature) | {
74
+ all_rust_features. retain ( |& ( _, feature) | {
77
75
// Retain if it is not a rustc feature
78
- !RUSTC_SPECIFIC_FEATURES . contains ( feature)
76
+ !RUSTC_SPECIFIC_FEATURES . contains ( & feature)
79
77
} ) ;
80
78
81
79
// Check feature validity.
@@ -103,7 +101,7 @@ pub(crate) fn global_gcc_features(sess: &Session, diagnostics: bool) -> Vec<Stri
103
101
} ;
104
102
sess. dcx ( ) . emit_warn ( unknown_feature) ;
105
103
}
106
- Some ( ( _, stability, _) ) => {
104
+ Some ( & ( _, stability, _) ) => {
107
105
if let Err ( reason) = stability. toggle_allowed ( ) {
108
106
sess. dcx ( ) . emit_warn ( ForbiddenCTargetFeature {
109
107
feature,
@@ -165,29 +163,25 @@ pub(crate) fn global_gcc_features(sess: &Session, diagnostics: bool) -> Vec<Stri
165
163
) ;
166
164
167
165
// 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) | {
171
168
let enable_disable = if enable { '+' } else { '-' } ;
172
169
// We run through `to_gcc_features` when
173
170
// passing requests down to GCC. This means that all in-language
174
171
// features also work on the command line instead of having two
175
172
// 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
+ } ) ;
191
185
features. extend ( feats) ;
192
186
193
187
if diagnostics {
0 commit comments