@@ -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 ( ) ) ,
@@ -1172,20 +1171,20 @@ pub fn get_cmd_lint_options(
1172
1171
matches : & getopts:: Matches ,
1173
1172
error_format : ErrorOutputType ,
1174
1173
debugging_opts : & DebuggingOptions ,
1175
- ) -> ( Vec < ( String , lint:: Level ) > , bool , Option < lint:: Level > , Vec < String > ) {
1174
+ ) -> ( Vec < ( String , lint:: Level ) > , bool , Option < lint:: Level > ) {
1176
1175
let mut lint_opts_with_position = vec ! [ ] ;
1177
1176
let mut describe_lints = false ;
1178
1177
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 ( ) ) {
1189
1188
if lint_name == "help" {
1190
1189
describe_lints = true ;
1191
1190
} else {
@@ -1206,18 +1205,7 @@ pub fn get_cmd_lint_options(
1206
1205
. unwrap_or_else ( || early_error ( error_format, & format ! ( "unknown lint level: `{}`" , cap) ) )
1207
1206
} ) ;
1208
1207
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)
1221
1209
}
1222
1210
1223
1211
/// Parses the `--color` flag.
@@ -1955,7 +1943,7 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
1955
1943
. unwrap_or_else ( |e| early_error ( error_format, & e[ ..] ) ) ;
1956
1944
1957
1945
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) =
1959
1947
get_cmd_lint_options ( matches, error_format, & debugging_opts) ;
1960
1948
1961
1949
check_debug_option_stability ( & debugging_opts, error_format, json_rendered) ;
@@ -2129,7 +2117,6 @@ pub fn build_session_options(matches: &getopts::Matches) -> Options {
2129
2117
optimize : opt_level,
2130
2118
debuginfo,
2131
2119
lint_opts,
2132
- force_warns,
2133
2120
lint_cap,
2134
2121
describe_lints,
2135
2122
output_types,
0 commit comments