Skip to content

Commit f725450

Browse files
committed
fix dogfood tests
remove unnecessary clone in parse_attrs
1 parent 6d22f60 commit f725450

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

clippy_lints/src/lib.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
956956
store.register_late_pass(|| box implicit_return::ImplicitReturn);
957957
store.register_late_pass(|| box implicit_saturating_sub::ImplicitSaturatingSub);
958958
let msrv = conf.msrv.clone();
959-
store.register_late_pass(move || box methods::Methods::new(String::from(msrv.clone())));
959+
store.register_late_pass(move || box methods::Methods::new(msrv.clone()));
960960
store.register_late_pass(|| box map_clone::MapClone);
961961
store.register_late_pass(|| box map_err_ignore::MapErrIgnore);
962962
store.register_late_pass(|| box shadow::Shadow);
@@ -971,7 +971,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
971971
let type_complexity_threshold = conf.type_complexity_threshold;
972972
store.register_late_pass(move || box types::TypeComplexity::new(type_complexity_threshold));
973973
let msrv = conf.msrv.clone();
974-
store.register_late_pass(move || box matches::Matches::new(String::from(msrv.clone())));
974+
store.register_late_pass(move || box matches::Matches::new(msrv.clone()));
975975
store.register_late_pass(|| box minmax::MinMaxPass);
976976
store.register_late_pass(|| box open_options::OpenOptions);
977977
store.register_late_pass(|| box zero_div_zero::ZeroDiv);
@@ -1131,7 +1131,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
11311131
store.register_late_pass(|| box mut_mutex_lock::MutMutexLock);
11321132
store.register_late_pass(|| box match_on_vec_items::MatchOnVecItems);
11331133
let msrv = conf.msrv.clone();
1134-
store.register_early_pass(move || box manual_non_exhaustive::ManualNonExhaustive::new(String::from(msrv.clone())));
1134+
store.register_early_pass(move || box manual_non_exhaustive::ManualNonExhaustive::new(msrv.clone()));
11351135
store.register_late_pass(|| box manual_async_fn::ManualAsyncFn);
11361136
store.register_early_pass(|| box redundant_field_names::RedundantFieldNames);
11371137
store.register_late_pass(|| box vec_resize_to_zero::VecResizeToZero);
@@ -1153,7 +1153,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
11531153
store.register_late_pass(|| box float_equality_without_abs::FloatEqualityWithoutAbs);
11541154
store.register_late_pass(|| box async_yields_async::AsyncYieldsAsync);
11551155
let msrv = conf.msrv.clone();
1156-
store.register_late_pass(move || box manual_strip::ManualStrip::new(String::from(msrv.clone())));
1156+
store.register_late_pass(move || box manual_strip::ManualStrip::new(msrv.clone()));
11571157
store.register_late_pass(|| box utils::internal_lints::MatchTypeOnDiagItem);
11581158
let disallowed_methods = conf.disallowed_methods.iter().cloned().collect::<FxHashSet<_>>();
11591159
store.register_late_pass(move || box disallowed_method::DisallowedMethod::new(&disallowed_methods));

clippy_lints/src/matches.rs

+2-4
Original file line numberDiff line numberDiff line change
@@ -565,10 +565,8 @@ impl<'tcx> LateLintPass<'tcx> for Matches {
565565

566566
redundant_pattern_match::check(cx, expr);
567567

568-
if Version::parse(&self.msrv_stack.limit()) >= Version::parse(MATCH_LIKE_MATCHES_MACRO_MSRV) {
569-
if !check_match_like_matches(cx, expr) {
570-
lint_match_arms(cx, expr);
571-
}
568+
if Version::parse(&self.msrv_stack.limit()) >= Version::parse(MATCH_LIKE_MATCHES_MACRO_MSRV) && !check_match_like_matches(cx, expr) {
569+
lint_match_arms(cx, expr);
572570
}
573571

574572
if let ExprKind::Match(ref ex, ref arms, MatchSource::Normal) = expr.kind {

clippy_lints/src/utils/attrs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ fn parse_attrs<T: std::clone::Clone + FromStr, F: FnMut(T)>(
118118
mut f: F,
119119
) {
120120
for attr in get_attr(sess, attrs, name) {
121-
if let Some(ref value) = attr.value_str().clone() {
121+
if let Some(ref value) = attr.value_str() {
122122
if let Ok(value) = FromStr::from_str(&value.as_str()) {
123123
f(value)
124124
} else {

0 commit comments

Comments
 (0)