@@ -44,6 +44,7 @@ extern crate rustc_target;
44
44
extern crate rustc_trait_selection;
45
45
extern crate rustc_typeck;
46
46
47
+ use crate :: utils:: parse_msrv;
47
48
use rustc_data_structures:: fx:: FxHashSet ;
48
49
use rustc_lint:: LintId ;
49
50
use rustc_session:: Session ;
@@ -440,14 +441,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
440
441
"clippy::unstable_as_mut_slice" ,
441
442
"`Vec::as_mut_slice` has been stabilized in 1.7" ,
442
443
) ;
443
- store. register_removed (
444
- "clippy::str_to_string" ,
445
- "using `str::to_string` is common even today and specialization will likely happen soon" ,
446
- ) ;
447
- store. register_removed (
448
- "clippy::string_to_string" ,
449
- "using `string::to_string` is common even today and specialization will likely happen soon" ,
450
- ) ;
451
444
store. register_removed (
452
445
"clippy::misaligned_transmute" ,
453
446
"this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr" ,
@@ -839,6 +832,8 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
839
832
& strings:: STRING_ADD_ASSIGN ,
840
833
& strings:: STRING_FROM_UTF8_AS_BYTES ,
841
834
& strings:: STRING_LIT_AS_BYTES ,
835
+ & strings:: STRING_TO_STRING ,
836
+ & strings:: STR_TO_STRING ,
842
837
& suspicious_trait_impl:: SUSPICIOUS_ARITHMETIC_IMPL ,
843
838
& suspicious_trait_impl:: SUSPICIOUS_OP_ASSIGN_IMPL ,
844
839
& swap:: ALMOST_SWAPPED ,
@@ -933,7 +928,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
933
928
& zero_div_zero:: ZERO_DIVIDED_BY_ZERO ,
934
929
] ) ;
935
930
// end register lints, do not remove this comment, it’s used in `update_lints`
936
-
937
931
store. register_late_pass ( || box await_holding_invalid:: AwaitHolding ) ;
938
932
store. register_late_pass ( || box serde_api:: SerdeAPI ) ;
939
933
store. register_late_pass ( || box utils:: internal_lints:: CompilerLintFunctions :: new ( ) ) ;
@@ -969,7 +963,23 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
969
963
store. register_late_pass ( || box strings:: StringAdd ) ;
970
964
store. register_late_pass ( || box implicit_return:: ImplicitReturn ) ;
971
965
store. register_late_pass ( || box implicit_saturating_sub:: ImplicitSaturatingSub ) ;
972
- store. register_late_pass ( || box methods:: Methods ) ;
966
+
967
+ let parsed_msrv = conf. msrv . as_ref ( ) . and_then ( |s| {
968
+ parse_msrv ( s, None , None ) . or_else ( || {
969
+ sess. err ( & format ! ( "error reading Clippy's configuration file. `{}` is not a valid Rust version" , s) ) ;
970
+ None
971
+ } )
972
+ } ) ;
973
+
974
+ let msrv = parsed_msrv. clone ( ) ;
975
+ store. register_late_pass ( move || box methods:: Methods :: new ( msrv. clone ( ) ) ) ;
976
+ let msrv = parsed_msrv. clone ( ) ;
977
+ store. register_late_pass ( move || box matches:: Matches :: new ( msrv. clone ( ) ) ) ;
978
+ let msrv = parsed_msrv. clone ( ) ;
979
+ store. register_early_pass ( move || box manual_non_exhaustive:: ManualNonExhaustive :: new ( msrv. clone ( ) ) ) ;
980
+ let msrv = parsed_msrv;
981
+ store. register_late_pass ( move || box manual_strip:: ManualStrip :: new ( msrv. clone ( ) ) ) ;
982
+
973
983
store. register_late_pass ( || box map_clone:: MapClone ) ;
974
984
store. register_late_pass ( || box map_err_ignore:: MapErrIgnore ) ;
975
985
store. register_late_pass ( || box shadow:: Shadow ) ;
@@ -983,7 +993,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
983
993
store. register_late_pass ( || box types:: Casts ) ;
984
994
let type_complexity_threshold = conf. type_complexity_threshold ;
985
995
store. register_late_pass ( move || box types:: TypeComplexity :: new ( type_complexity_threshold) ) ;
986
- store. register_late_pass ( || box matches:: Matches :: default ( ) ) ;
987
996
store. register_late_pass ( || box minmax:: MinMaxPass ) ;
988
997
store. register_late_pass ( || box open_options:: OpenOptions ) ;
989
998
store. register_late_pass ( || box zero_div_zero:: ZeroDiv ) ;
@@ -1144,7 +1153,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
1144
1153
store. register_late_pass ( || box if_let_mutex:: IfLetMutex ) ;
1145
1154
store. register_late_pass ( || box mut_mutex_lock:: MutMutexLock ) ;
1146
1155
store. register_late_pass ( || box match_on_vec_items:: MatchOnVecItems ) ;
1147
- store. register_early_pass ( || box manual_non_exhaustive:: ManualNonExhaustive ) ;
1148
1156
store. register_late_pass ( || box manual_async_fn:: ManualAsyncFn ) ;
1149
1157
store. register_early_pass ( || box redundant_field_names:: RedundantFieldNames ) ;
1150
1158
store. register_late_pass ( || box vec_resize_to_zero:: VecResizeToZero ) ;
@@ -1166,13 +1174,14 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
1166
1174
store. register_late_pass ( || box manual_ok_or:: ManualOkOr ) ;
1167
1175
store. register_late_pass ( || box float_equality_without_abs:: FloatEqualityWithoutAbs ) ;
1168
1176
store. register_late_pass ( || box async_yields_async:: AsyncYieldsAsync ) ;
1169
- store. register_late_pass ( || box manual_strip:: ManualStrip ) ;
1170
1177
store. register_late_pass ( || box utils:: internal_lints:: MatchTypeOnDiagItem ) ;
1171
1178
let disallowed_methods = conf. disallowed_methods . iter ( ) . cloned ( ) . collect :: < FxHashSet < _ > > ( ) ;
1172
1179
store. register_late_pass ( move || box disallowed_method:: DisallowedMethod :: new ( & disallowed_methods) ) ;
1173
1180
store. register_early_pass ( || box asm_syntax:: InlineAsmX86AttSyntax ) ;
1174
1181
store. register_early_pass ( || box asm_syntax:: InlineAsmX86IntelSyntax ) ;
1175
1182
store. register_late_pass ( || box undropped_manually_drops:: UndroppedManuallyDrops ) ;
1183
+ store. register_late_pass ( || box strings:: StrToString ) ;
1184
+ store. register_late_pass ( || box strings:: StringToString ) ;
1176
1185
1177
1186
1178
1187
store. register_group ( true , "clippy::restriction" , Some ( "clippy_restriction" ) , vec ! [
@@ -1215,6 +1224,8 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
1215
1224
LintId :: of( & shadow:: SHADOW_REUSE ) ,
1216
1225
LintId :: of( & shadow:: SHADOW_SAME ) ,
1217
1226
LintId :: of( & strings:: STRING_ADD ) ,
1227
+ LintId :: of( & strings:: STRING_TO_STRING ) ,
1228
+ LintId :: of( & strings:: STR_TO_STRING ) ,
1218
1229
LintId :: of( & types:: RC_BUFFER ) ,
1219
1230
LintId :: of( & unwrap_in_result:: UNWRAP_IN_RESULT ) ,
1220
1231
LintId :: of( & verbose_file_reads:: VERBOSE_FILE_READS ) ,
@@ -1930,14 +1941,6 @@ fn register_removed_non_tool_lints(store: &mut rustc_lint::LintStore) {
1930
1941
"unstable_as_mut_slice" ,
1931
1942
"`Vec::as_mut_slice` has been stabilized in 1.7" ,
1932
1943
) ;
1933
- store. register_removed (
1934
- "str_to_string" ,
1935
- "using `str::to_string` is common even today and specialization will likely happen soon" ,
1936
- ) ;
1937
- store. register_removed (
1938
- "string_to_string" ,
1939
- "using `string::to_string` is common even today and specialization will likely happen soon" ,
1940
- ) ;
1941
1944
store. register_removed (
1942
1945
"misaligned_transmute" ,
1943
1946
"this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr" ,
0 commit comments