@@ -25,9 +25,8 @@ fn sort_and_truncate_possibilities(
2525 } else {
2626 match filter_well_known_names {
2727 FilterWellKnownNames :: Yes => {
28- possibilities. retain ( |cfg_name| {
29- !sess. psess . check_config . well_known_names . contains ( cfg_name)
30- } ) ;
28+ possibilities
29+ . retain ( |cfg_name| !sess. check_config . well_known_names . contains ( cfg_name) ) ;
3130 }
3231 FilterWellKnownNames :: No => { }
3332 } ;
@@ -105,13 +104,12 @@ pub(crate) fn unexpected_cfg_name(
105104 value : Option < ( Symbol , Span ) > ,
106105) -> errors:: UnexpectedCfgName {
107106 #[ allow( rustc:: potential_query_instability) ]
108- let possibilities: Vec < Symbol > = sess. psess . check_config . expecteds . keys ( ) . copied ( ) . collect ( ) ;
107+ let possibilities: Vec < Symbol > = sess. check_config . expecteds . keys ( ) . copied ( ) . collect ( ) ;
109108
110109 let mut names_possibilities: Vec < _ > = if value. is_none ( ) {
111110 // We later sort and display all the possibilities, so the order here does not matter.
112111 #[ allow( rustc:: potential_query_instability) ]
113- sess. psess
114- . check_config
112+ sess. check_config
115113 . expecteds
116114 . iter ( )
117115 . filter_map ( |( k, v) | match v {
@@ -167,7 +165,7 @@ pub(crate) fn unexpected_cfg_name(
167165 is_feature_cfg |= best_match == sym:: feature;
168166
169167 if let Some ( ExpectedValues :: Some ( best_match_values) ) =
170- sess. psess . check_config . expecteds . get ( & best_match)
168+ sess. check_config . expecteds . get ( & best_match)
171169 {
172170 // We will soon sort, so the initial order does not matter.
173171 #[ allow( rustc:: potential_query_instability) ]
@@ -285,7 +283,7 @@ pub(crate) fn unexpected_cfg_value(
285283 ( name, name_span) : ( Symbol , Span ) ,
286284 value : Option < ( Symbol , Span ) > ,
287285) -> errors:: UnexpectedCfgValue {
288- let Some ( ExpectedValues :: Some ( values) ) = & sess. psess . check_config . expecteds . get ( & name) else {
286+ let Some ( ExpectedValues :: Some ( values) ) = & sess. check_config . expecteds . get ( & name) else {
289287 panic ! (
290288 "it shouldn't be possible to have a diagnostic on a value whose name is not in values"
291289 ) ;
@@ -305,7 +303,7 @@ pub(crate) fn unexpected_cfg_value(
305303 let is_from_external_macro = name_span. in_external_macro ( sess. source_map ( ) ) ;
306304
307305 let code_sugg = if let Some ( ( value, _) ) = value
308- && sess. psess . check_config . well_known_names . contains ( & name)
306+ && sess. check_config . well_known_names . contains ( & name)
309307 && let valid_names = possible_well_known_names_for_cfg_value ( sess, value)
310308 && !valid_names. is_empty ( )
311309 {
@@ -378,12 +376,12 @@ pub(crate) fn unexpected_cfg_value(
378376 // We don't want to encourage people to add values to a well-known names, as these are
379377 // defined by rustc/Rust itself. Users can still do this if they wish, but should not be
380378 // encouraged to do so.
381- let can_suggest_adding_value = !sess. psess . check_config . well_known_names . contains ( & name)
379+ let can_suggest_adding_value = !sess. check_config . well_known_names . contains ( & name)
382380 // Except when working on rustc or the standard library itself, in which case we want to
383381 // suggest adding these cfgs to the "normal" place because of bootstrapping reasons. As a
384382 // basic heuristic, we use the "cheat" unstable feature enable method and the
385383 // non-ui-testing enabled option.
386- || ( matches ! ( sess. psess . unstable_features, rustc_feature:: UnstableFeatures :: Cheat )
384+ || ( matches ! ( sess. unstable_features, rustc_feature:: UnstableFeatures :: Cheat )
387385 && !sess. opts . unstable_opts . ui_testing ) ;
388386
389387 let inst = |escape_quotes| {
@@ -429,13 +427,11 @@ pub(crate) fn unexpected_cfg_value(
429427fn possible_well_known_names_for_cfg_value ( sess : & Session , value : Symbol ) -> Vec < Symbol > {
430428 #[ allow( rustc:: potential_query_instability) ]
431429 let mut names = sess
432- . psess
433430 . check_config
434431 . well_known_names
435432 . iter ( )
436433 . filter ( |name| {
437- sess. psess
438- . check_config
434+ sess. check_config
439435 . expecteds
440436 . get ( * name)
441437 . map ( |expected_values| expected_values. contains ( & Some ( value) ) )
0 commit comments