Skip to content

Commit b0c826f

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

File tree

4 files changed

+14
-19
lines changed

4 files changed

+14
-19
lines changed

clippy_lints/src/lib.rs

Lines changed: 4 additions & 4 deletions
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

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -529,10 +529,7 @@ pub struct Matches {
529529
impl Matches {
530530
#[must_use]
531531
pub fn new(msrv: String) -> Self {
532-
Self {
533-
msrv_stack: LimitStack::new(msrv),
534-
..Default::default()
535-
}
532+
Self { msrv_stack: LimitStack::new(msrv), ..Default::default()}
536533
}
537534
}
538535

@@ -565,10 +562,8 @@ impl<'tcx> LateLintPass<'tcx> for Matches {
565562

566563
redundant_pattern_match::check(cx, expr);
567564

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-
}
565+
if Version::parse(&self.msrv_stack.limit()) >= Version::parse(MATCH_LIKE_MATCHES_MACRO_MSRV) && !check_match_like_matches(cx, expr) {
566+
lint_match_arms(cx, expr);
572567
}
573568

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

clippy_lints/src/methods/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1380,7 +1380,7 @@ impl Methods {
13801380
#[must_use]
13811381
pub fn new(msrv: String) -> Self {
13821382
Self {
1383-
msrv_stack: LimitStack::new(msrv.clone()),
1383+
msrv_stack: LimitStack::new(msrv),
13841384
}
13851385
}
13861386
}

clippy_lints/src/utils/attrs.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ pub struct LimitStack<T> {
2929
stack: Vec<T>,
3030
}
3131

32-
impl<T> Drop for LimitStack<T> {
33-
fn drop(&mut self) {
34-
assert_eq!(1, 1);
35-
}
36-
}
32+
// impl<T> Drop for LimitStack<T> {
33+
// fn drop(&mut self) {
34+
// assert_eq!(1, 1);
35+
// }
36+
// }
3737

3838
impl<T: std::cmp::PartialEq + std::fmt::Debug + FromStr + Clone> LimitStack<T> {
3939
#[must_use]
@@ -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)