@@ -677,7 +677,6 @@ impl Default for Options {
677677 optimize : OptLevel :: No ,
678678 debuginfo : DebugInfo :: None ,
679679 lint_opts : Vec :: new ( ) ,
680- force_warns : Vec :: new ( ) ,
681680 lint_cap : None ,
682681 describe_lints : false ,
683682 output_types : OutputTypes ( BTreeMap :: new ( ) ) ,
@@ -1170,20 +1169,20 @@ pub fn get_cmd_lint_options(
11701169 matches : & getopts:: Matches ,
11711170 error_format : ErrorOutputType ,
11721171 debugging_opts : & DebuggingOptions ,
1173- ) -> ( Vec < ( String , lint:: Level ) > , bool , Option < lint:: Level > , Vec < String > ) {
1172+ ) -> ( Vec < ( String , lint:: Level ) > , bool , Option < lint:: Level > ) {
11741173 let mut lint_opts_with_position = vec ! [ ] ;
11751174 let mut describe_lints = false ;
11761175
1177- for level in [ lint :: Allow , lint :: Warn , lint :: Deny , lint :: Forbid ] {
1178- for ( passed_arg_pos , lint_name ) in matches . opt_strs_pos ( level . as_str ( ) ) {
1179- let arg_pos = if let lint :: Forbid = level {
1180- // HACK: forbid is always specified last, so it can't be overridden.
1181- // FIXME: remove this once <https://github.com/rust-lang/rust/issues/70819> is
1182- // fixed and `forbid` works as expected.
1183- usize :: MAX
1184- } else {
1185- passed_arg_pos
1186- } ;
1176+ if !debugging_opts . unstable_options && matches . opt_present ( "force-warns" ) {
1177+ early_error (
1178+ error_format ,
1179+ "the `-Z unstable-options` flag must also be passed to enable \
1180+ the flag `--force-warns=lints`" ,
1181+ ) ;
1182+ }
1183+
1184+ for level in [ lint :: Allow , lint :: Warn , lint :: ForceWarn , lint :: Deny , lint :: Forbid ] {
1185+ for ( arg_pos , lint_name ) in matches . opt_strs_pos ( level . as_str ( ) ) {
11871186 if lint_name == "help" {
11881187 describe_lints = true ;
11891188 } else {
@@ -1204,18 +1203,7 @@ pub fn get_cmd_lint_options(
12041203 . unwrap_or_else ( || early_error ( error_format, & format ! ( "unknown lint level: `{}`" , cap) ) )
12051204 } ) ;
12061205
1207- if !debugging_opts. unstable_options && matches. opt_present ( "force-warns" ) {
1208- early_error (
1209- error_format,
1210- "the `-Z unstable-options` flag must also be passed to enable \
1211- the flag `--force-warns=lints`",
1212- ) ;
1213- }
1214-
1215- let force_warns =
1216- matches. opt_strs ( "force-warns" ) . into_iter ( ) . map ( |name| name. replace ( '-' , "_" ) ) . collect ( ) ;
1217-
1218- ( lint_opts, describe_lints, lint_cap, force_warns)
1206+ ( lint_opts, describe_lints, lint_cap)
12191207}
12201208
12211209/// Parses the `--color` flag.
@@ -1953,7 +1941,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
19531941 . unwrap_or_else ( |e| early_error ( error_format, & e[ ..] ) ) ;
19541942
19551943 let mut debugging_opts = DebuggingOptions :: build ( matches, error_format) ;
1956- let ( lint_opts, describe_lints, lint_cap, force_warns ) =
1944+ let ( lint_opts, describe_lints, lint_cap) =
19571945 get_cmd_lint_options ( matches, error_format, & debugging_opts) ;
19581946
19591947 check_debug_option_stability ( & debugging_opts, error_format, json_rendered) ;
@@ -2127,7 +2115,6 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
21272115 optimize : opt_level,
21282116 debuginfo,
21292117 lint_opts,
2130- force_warns,
21312118 lint_cap,
21322119 describe_lints,
21332120 output_types,
0 commit comments