Skip to content

Commit ef1a3b9

Browse files
committed
Auto merge of #90561 - flip1995:clippy_backport, r=Mark-Simulacrum
[beta] Backport Clippy lint renaming / regrouping This backports PR rust-lang/rust-clippy#7810 to beta, where a lint added in the 1.57 (current beta) release cycle was renamed shortly after the beta cutoff. We want to backport this, so we don't have unnecessary `lint_store.registered_renamed` calls in the Clippy codebase forever. (The formatting changes were necessary to pass this backport in the Clippy CI, removing it in a subtree sync would be a bit painful...) cc `@camsteffen`
2 parents 7611e64 + 4cd7ad0 commit ef1a3b9

25 files changed

+95
-89
lines changed

src/tools/clippy/CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2746,7 +2746,6 @@ Released 2018-09-13
27462746
[`if_let_redundant_pattern_matching`]: https://rust-lang.github.io/rust-clippy/master/index.html#if_let_redundant_pattern_matching
27472747
[`if_not_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#if_not_else
27482748
[`if_same_then_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else
2749-
[`if_then_panic`]: https://rust-lang.github.io/rust-clippy/master/index.html#if_then_panic
27502749
[`if_then_some_else_none`]: https://rust-lang.github.io/rust-clippy/master/index.html#if_then_some_else_none
27512750
[`ifs_same_cond`]: https://rust-lang.github.io/rust-clippy/master/index.html#ifs_same_cond
27522751
[`implicit_clone`]: https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone
@@ -2804,6 +2803,7 @@ Released 2018-09-13
28042803
[`lossy_float_literal`]: https://rust-lang.github.io/rust-clippy/master/index.html#lossy_float_literal
28052804
[`macro_use_imports`]: https://rust-lang.github.io/rust-clippy/master/index.html#macro_use_imports
28062805
[`main_recursion`]: https://rust-lang.github.io/rust-clippy/master/index.html#main_recursion
2806+
[`manual_assert`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_assert
28072807
[`manual_async_fn`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_async_fn
28082808
[`manual_filter_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_filter_map
28092809
[`manual_find_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#manual_find_map

src/tools/clippy/clippy_lints/src/dereference.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing {
126126
target_mut,
127127
},
128128
));
129-
}
129+
},
130130
_ => (),
131131
}
132132
},

src/tools/clippy/clippy_lints/src/entry.rs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,14 @@ fn try_parse_contains(cx: &LateContext<'_>, expr: &'tcx Expr<'_>) -> Option<(Map
245245
ExprKind::MethodCall(
246246
_,
247247
_,
248-
[map, Expr {
249-
kind: ExprKind::AddrOf(_, _, key),
250-
span: key_span,
251-
..
252-
}],
248+
[
249+
map,
250+
Expr {
251+
kind: ExprKind::AddrOf(_, _, key),
252+
span: key_span,
253+
..
254+
},
255+
],
253256
_,
254257
) if key_span.ctxt() == expr.span.ctxt() => {
255258
let id = cx.typeck_results().type_dependent_def_id(expr.hir_id)?;

src/tools/clippy/clippy_lints/src/eta_reduction.rs

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,13 +169,16 @@ fn check_inputs(cx: &LateContext<'_>, params: &[Param<'_>], call_args: &[Expr<'_
169169
}
170170
match *cx.typeck_results().expr_adjustments(arg) {
171171
[] => true,
172-
[Adjustment {
173-
kind: Adjust::Deref(None),
174-
..
175-
}, Adjustment {
176-
kind: Adjust::Borrow(AutoBorrow::Ref(_, mu2)),
177-
..
178-
}] => {
172+
[
173+
Adjustment {
174+
kind: Adjust::Deref(None),
175+
..
176+
},
177+
Adjustment {
178+
kind: Adjust::Borrow(AutoBorrow::Ref(_, mu2)),
179+
..
180+
},
181+
] => {
179182
// re-borrow with the same mutability is allowed
180183
let ty = cx.typeck_results().expr_ty(arg);
181184
matches!(*ty.kind(), ty::Ref(.., mu1) if mu1 == mu2.into())

src/tools/clippy/clippy_lints/src/int_plus_one.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl IntPlusOne {
8989
},
9090
_ => None,
9191
}
92-
}
92+
},
9393
// case where `x + 1 <= ...` or `1 + x <= ...`
9494
(BinOpKind::Le, &ExprKind::Binary(ref lhskind, ref lhslhs, ref lhsrhs), _)
9595
if lhskind.node == BinOpKind::Add =>
@@ -104,7 +104,7 @@ impl IntPlusOne {
104104
},
105105
_ => None,
106106
}
107-
}
107+
},
108108
// case where `... >= y - 1` or `... >= -1 + y`
109109
(BinOpKind::Le, _, &ExprKind::Binary(ref rhskind, ref rhslhs, ref rhsrhs)) => {
110110
match (rhskind.node, &rhslhs.kind, &rhsrhs.kind) {

src/tools/clippy/clippy_lints/src/lib.register_all.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,6 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![
7474
LintId::of(get_last_with_len::GET_LAST_WITH_LEN),
7575
LintId::of(identity_op::IDENTITY_OP),
7676
LintId::of(if_let_mutex::IF_LET_MUTEX),
77-
LintId::of(if_then_panic::IF_THEN_PANIC),
7877
LintId::of(indexing_slicing::OUT_OF_BOUNDS_INDEXING),
7978
LintId::of(infinite_iter::INFINITE_ITER),
8079
LintId::of(inherent_to_string::INHERENT_TO_STRING),

src/tools/clippy/clippy_lints/src/lib.register_lints.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,6 @@ store.register_lints(&[
156156
identity_op::IDENTITY_OP,
157157
if_let_mutex::IF_LET_MUTEX,
158158
if_not_else::IF_NOT_ELSE,
159-
if_then_panic::IF_THEN_PANIC,
160159
if_then_some_else_none::IF_THEN_SOME_ELSE_NONE,
161160
implicit_hasher::IMPLICIT_HASHER,
162161
implicit_return::IMPLICIT_RETURN,
@@ -213,6 +212,7 @@ store.register_lints(&[
213212
loops::WHILE_LET_ON_ITERATOR,
214213
macro_use::MACRO_USE_IMPORTS,
215214
main_recursion::MAIN_RECURSION,
215+
manual_assert::MANUAL_ASSERT,
216216
manual_async_fn::MANUAL_ASYNC_FN,
217217
manual_map::MANUAL_MAP,
218218
manual_non_exhaustive::MANUAL_NON_EXHAUSTIVE,

src/tools/clippy/clippy_lints/src/lib.register_pedantic.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ store.register_group(true, "clippy::pedantic", Some("clippy_pedantic"), vec![
4848
LintId::of(loops::EXPLICIT_INTO_ITER_LOOP),
4949
LintId::of(loops::EXPLICIT_ITER_LOOP),
5050
LintId::of(macro_use::MACRO_USE_IMPORTS),
51+
LintId::of(manual_assert::MANUAL_ASSERT),
5152
LintId::of(manual_ok_or::MANUAL_OK_OR),
5253
LintId::of(match_on_vec_items::MATCH_ON_VEC_ITEMS),
5354
LintId::of(matches::MATCH_BOOL),

src/tools/clippy/clippy_lints/src/lib.register_style.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ store.register_group(true, "clippy::style", Some("clippy_style"), vec![
2727
LintId::of(functions::DOUBLE_MUST_USE),
2828
LintId::of(functions::MUST_USE_UNIT),
2929
LintId::of(functions::RESULT_UNIT_ERR),
30-
LintId::of(if_then_panic::IF_THEN_PANIC),
3130
LintId::of(inherent_to_string::INHERENT_TO_STRING),
3231
LintId::of(len_zero::COMPARISON_TO_EMPTY),
3332
LintId::of(len_zero::LEN_WITHOUT_IS_EMPTY),

src/tools/clippy/clippy_lints/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ mod get_last_with_len;
227227
mod identity_op;
228228
mod if_let_mutex;
229229
mod if_not_else;
230-
mod if_then_panic;
231230
mod if_then_some_else_none;
232231
mod implicit_hasher;
233232
mod implicit_return;
@@ -254,6 +253,7 @@ mod literal_representation;
254253
mod loops;
255254
mod macro_use;
256255
mod main_recursion;
256+
mod manual_assert;
257257
mod manual_async_fn;
258258
mod manual_map;
259259
mod manual_non_exhaustive;
@@ -764,7 +764,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
764764
store.register_late_pass(move || Box::new(self_named_constructors::SelfNamedConstructors));
765765
store.register_late_pass(move || Box::new(feature_name::FeatureName));
766766
store.register_late_pass(move || Box::new(iter_not_returning_iterator::IterNotReturningIterator));
767-
store.register_late_pass(move || Box::new(if_then_panic::IfThenPanic));
767+
store.register_late_pass(move || Box::new(manual_assert::ManualAssert));
768768
let enable_raw_pointer_heuristic_for_send = conf.enable_raw_pointer_heuristic_for_send;
769769
store.register_late_pass(move || Box::new(non_send_fields_in_send_ty::NonSendFieldInSendTy::new(enable_raw_pointer_heuristic_for_send)));
770770
}

0 commit comments

Comments
 (0)