@@ -677,7 +677,6 @@ impl Default for Options {
677
677
optimize : OptLevel :: No ,
678
678
debuginfo : DebugInfo :: None ,
679
679
lint_opts : Vec :: new ( ) ,
680
- force_warns : Vec :: new ( ) ,
681
680
lint_cap : None ,
682
681
describe_lints : false ,
683
682
output_types : OutputTypes ( BTreeMap :: new ( ) ) ,
@@ -1170,20 +1169,20 @@ pub fn get_cmd_lint_options(
1170
1169
matches : & getopts:: Matches ,
1171
1170
error_format : ErrorOutputType ,
1172
1171
debugging_opts : & DebuggingOptions ,
1173
- ) -> ( Vec < ( String , lint:: Level ) > , bool , Option < lint:: Level > , Vec < String > ) {
1172
+ ) -> ( Vec < ( String , lint:: Level ) > , bool , Option < lint:: Level > ) {
1174
1173
let mut lint_opts_with_position = vec ! [ ] ;
1175
1174
let mut describe_lints = false ;
1176
1175
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 ( ) ) {
1187
1186
if lint_name == "help" {
1188
1187
describe_lints = true ;
1189
1188
} else {
@@ -1204,18 +1203,7 @@ pub fn get_cmd_lint_options(
1204
1203
. unwrap_or_else ( || early_error ( error_format, & format ! ( "unknown lint level: `{}`" , cap) ) )
1205
1204
} ) ;
1206
1205
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)
1219
1207
}
1220
1208
1221
1209
/// Parses the `--color` flag.
@@ -1953,7 +1941,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
1953
1941
. unwrap_or_else ( |e| early_error ( error_format, & e[ ..] ) ) ;
1954
1942
1955
1943
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) =
1957
1945
get_cmd_lint_options ( matches, error_format, & debugging_opts) ;
1958
1946
1959
1947
check_debug_option_stability ( & debugging_opts, error_format, json_rendered) ;
@@ -2127,7 +2115,6 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
2127
2115
optimize : opt_level,
2128
2116
debuginfo,
2129
2117
lint_opts,
2130
- force_warns,
2131
2118
lint_cap,
2132
2119
describe_lints,
2133
2120
output_types,
0 commit comments