@@ -44,6 +44,7 @@ extern crate rustc_target;
4444extern crate rustc_trait_selection;
4545extern crate rustc_typeck;
4646
47+ use crate :: utils:: parse_msrv;
4748use rustc_data_structures:: fx:: FxHashSet ;
4849use rustc_lint:: LintId ;
4950use rustc_session:: Session ;
@@ -440,14 +441,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
440441 "clippy::unstable_as_mut_slice" ,
441442 "`Vec::as_mut_slice` has been stabilized in 1.7" ,
442443 ) ;
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- ) ;
451444 store. register_removed (
452445 "clippy::misaligned_transmute" ,
453446 "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:
839832 & strings:: STRING_ADD_ASSIGN ,
840833 & strings:: STRING_FROM_UTF8_AS_BYTES ,
841834 & strings:: STRING_LIT_AS_BYTES ,
835+ & strings:: STRING_TO_STRING ,
836+ & strings:: STR_TO_STRING ,
842837 & suspicious_trait_impl:: SUSPICIOUS_ARITHMETIC_IMPL ,
843838 & suspicious_trait_impl:: SUSPICIOUS_OP_ASSIGN_IMPL ,
844839 & swap:: ALMOST_SWAPPED ,
@@ -933,7 +928,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
933928 & zero_div_zero:: ZERO_DIVIDED_BY_ZERO ,
934929 ] ) ;
935930 // end register lints, do not remove this comment, it’s used in `update_lints`
936-
937931 store. register_late_pass ( || box await_holding_invalid:: AwaitHolding ) ;
938932 store. register_late_pass ( || box serde_api:: SerdeAPI ) ;
939933 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:
969963 store. register_late_pass ( || box strings:: StringAdd ) ;
970964 store. register_late_pass ( || box implicit_return:: ImplicitReturn ) ;
971965 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+
973983 store. register_late_pass ( || box map_clone:: MapClone ) ;
974984 store. register_late_pass ( || box map_err_ignore:: MapErrIgnore ) ;
975985 store. register_late_pass ( || box shadow:: Shadow ) ;
@@ -983,7 +993,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
983993 store. register_late_pass ( || box types:: Casts ) ;
984994 let type_complexity_threshold = conf. type_complexity_threshold ;
985995 store. register_late_pass ( move || box types:: TypeComplexity :: new ( type_complexity_threshold) ) ;
986- store. register_late_pass ( || box matches:: Matches :: default ( ) ) ;
987996 store. register_late_pass ( || box minmax:: MinMaxPass ) ;
988997 store. register_late_pass ( || box open_options:: OpenOptions ) ;
989998 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:
11441153 store. register_late_pass ( || box if_let_mutex:: IfLetMutex ) ;
11451154 store. register_late_pass ( || box mut_mutex_lock:: MutMutexLock ) ;
11461155 store. register_late_pass ( || box match_on_vec_items:: MatchOnVecItems ) ;
1147- store. register_early_pass ( || box manual_non_exhaustive:: ManualNonExhaustive ) ;
11481156 store. register_late_pass ( || box manual_async_fn:: ManualAsyncFn ) ;
11491157 store. register_early_pass ( || box redundant_field_names:: RedundantFieldNames ) ;
11501158 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:
11661174 store. register_late_pass ( || box manual_ok_or:: ManualOkOr ) ;
11671175 store. register_late_pass ( || box float_equality_without_abs:: FloatEqualityWithoutAbs ) ;
11681176 store. register_late_pass ( || box async_yields_async:: AsyncYieldsAsync ) ;
1169- store. register_late_pass ( || box manual_strip:: ManualStrip ) ;
11701177 store. register_late_pass ( || box utils:: internal_lints:: MatchTypeOnDiagItem ) ;
11711178 let disallowed_methods = conf. disallowed_methods . iter ( ) . cloned ( ) . collect :: < FxHashSet < _ > > ( ) ;
11721179 store. register_late_pass ( move || box disallowed_method:: DisallowedMethod :: new ( & disallowed_methods) ) ;
11731180 store. register_early_pass ( || box asm_syntax:: InlineAsmX86AttSyntax ) ;
11741181 store. register_early_pass ( || box asm_syntax:: InlineAsmX86IntelSyntax ) ;
11751182 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 ) ;
11761185
11771186
11781187 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:
12151224 LintId :: of( & shadow:: SHADOW_REUSE ) ,
12161225 LintId :: of( & shadow:: SHADOW_SAME ) ,
12171226 LintId :: of( & strings:: STRING_ADD ) ,
1227+ LintId :: of( & strings:: STRING_TO_STRING ) ,
1228+ LintId :: of( & strings:: STR_TO_STRING ) ,
12181229 LintId :: of( & types:: RC_BUFFER ) ,
12191230 LintId :: of( & unwrap_in_result:: UNWRAP_IN_RESULT ) ,
12201231 LintId :: of( & verbose_file_reads:: VERBOSE_FILE_READS ) ,
@@ -1930,14 +1941,6 @@ fn register_removed_non_tool_lints(store: &mut rustc_lint::LintStore) {
19301941 "unstable_as_mut_slice" ,
19311942 "`Vec::as_mut_slice` has been stabilized in 1.7" ,
19321943 ) ;
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- ) ;
19411944 store. register_removed (
19421945 "misaligned_transmute" ,
19431946 "this lint has been split into cast_ptr_alignment and transmute_ptr_to_ptr" ,
0 commit comments