@@ -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 ( ) ) ,
@@ -1172,20 +1171,20 @@ pub fn get_cmd_lint_options(
11721171 matches : & getopts:: Matches ,
11731172 error_format : ErrorOutputType ,
11741173 debugging_opts : & DebuggingOptions ,
1175- ) -> ( Vec < ( String , lint:: Level ) > , bool , Option < lint:: Level > , Vec < String > ) {
1174+ ) -> ( Vec < ( String , lint:: Level ) > , bool , Option < lint:: Level > ) {
11761175 let mut lint_opts_with_position = vec ! [ ] ;
11771176 let mut describe_lints = false ;
11781177
1179- for level in [ lint :: Allow , lint :: Warn , lint :: Deny , lint :: Forbid ] {
1180- for ( passed_arg_pos , lint_name ) in matches . opt_strs_pos ( level . as_str ( ) ) {
1181- let arg_pos = if let lint :: Forbid = level {
1182- // HACK: forbid is always specified last, so it can't be overridden.
1183- // FIXME: remove this once <https://github.com/rust-lang/rust/issues/70819> is
1184- // fixed and `forbid` works as expected.
1185- usize :: MAX
1186- } else {
1187- passed_arg_pos
1188- } ;
1178+ if !debugging_opts . unstable_options && matches . opt_present ( "force-warns" ) {
1179+ early_error (
1180+ error_format ,
1181+ "the `-Z unstable-options` flag must also be passed to enable \
1182+ the flag `--force-warns=lints`" ,
1183+ ) ;
1184+ }
1185+
1186+ for level in [ lint :: Allow , lint :: Warn , lint :: ForceWarn , lint :: Deny , lint :: Forbid ] {
1187+ for ( arg_pos , lint_name ) in matches . opt_strs_pos ( level . as_str ( ) ) {
11891188 if lint_name == "help" {
11901189 describe_lints = true ;
11911190 } else {
@@ -1206,18 +1205,7 @@ pub fn get_cmd_lint_options(
12061205 . unwrap_or_else ( || early_error ( error_format, & format ! ( "unknown lint level: `{}`" , cap) ) )
12071206 } ) ;
12081207
1209- if !debugging_opts. unstable_options && matches. opt_present ( "force-warns" ) {
1210- early_error (
1211- error_format,
1212- "the `-Z unstable-options` flag must also be passed to enable \
1213- the flag `--force-warns=lints`",
1214- ) ;
1215- }
1216-
1217- let force_warns =
1218- matches. opt_strs ( "force-warns" ) . into_iter ( ) . map ( |name| name. replace ( '-' , "_" ) ) . collect ( ) ;
1219-
1220- ( lint_opts, describe_lints, lint_cap, force_warns)
1208+ ( lint_opts, describe_lints, lint_cap)
12211209}
12221210
12231211/// Parses the `--color` flag.
@@ -1955,7 +1943,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
19551943 . unwrap_or_else ( |e| early_error ( error_format, & e[ ..] ) ) ;
19561944
19571945 let mut debugging_opts = DebuggingOptions :: build ( matches, error_format) ;
1958- let ( lint_opts, describe_lints, lint_cap, force_warns ) =
1946+ let ( lint_opts, describe_lints, lint_cap) =
19591947 get_cmd_lint_options ( matches, error_format, & debugging_opts) ;
19601948
19611949 check_debug_option_stability ( & debugging_opts, error_format, json_rendered) ;
@@ -2129,7 +2117,6 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
21292117 optimize : opt_level,
21302118 debuginfo,
21312119 lint_opts,
2132- force_warns,
21332120 lint_cap,
21342121 describe_lints,
21352122 output_types,
0 commit comments