From 5e2a2d3ac993cc6b89e561e69b4571d95d0f7627 Mon Sep 17 00:00:00 2001 From: Jason Newcomb Date: Tue, 14 Jun 2022 11:44:43 -0400 Subject: [PATCH] Fix dogfood --- clippy_dev/src/update_lints.rs | 2 +- clippy_lints/src/dereference.rs | 26 +++++++++---------- clippy_lints/src/matches/match_same_arms.rs | 2 +- .../src/matches/match_single_binding.rs | 4 +-- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/clippy_dev/src/update_lints.rs b/clippy_dev/src/update_lints.rs index 115f5f0064f..2e0659f42d7 100644 --- a/clippy_dev/src/update_lints.rs +++ b/clippy_dev/src/update_lints.rs @@ -413,7 +413,7 @@ fn remove_impl_lint_pass(lint_name_upper: &str, content: &mut String) { .find("declare_lint_pass!") .unwrap_or_else(|| panic!("failed to find `impl_lint_pass`")) }); - let mut impl_lint_pass_end = (&content[impl_lint_pass_start..]) + let mut impl_lint_pass_end = content[impl_lint_pass_start..] .find(']') .expect("failed to find `impl_lint_pass` terminator"); diff --git a/clippy_lints/src/dereference.rs b/clippy_lints/src/dereference.rs index e80ee6af650..59dcc1ebf19 100644 --- a/clippy_lints/src/dereference.rs +++ b/clippy_lints/src/dereference.rs @@ -911,7 +911,18 @@ fn param_auto_deref_stability(ty: Ty<'_>, precedence: i8) -> Position { ty = ref_ty; continue; }, - ty::Bool + ty::Infer(_) + | ty::Error(_) + | ty::Param(_) + | ty::Bound(..) + | ty::Opaque(..) + | ty::Placeholder(_) + | ty::Dynamic(..) => Position::ReborrowStable(precedence), + ty::Adt(..) if ty.has_placeholders() || ty.has_param_types_or_consts() => { + Position::ReborrowStable(precedence) + }, + ty::Adt(..) + | ty::Bool | ty::Char | ty::Int(_) | ty::Uint(_) @@ -929,17 +940,6 @@ fn param_auto_deref_stability(ty: Ty<'_>, precedence: i8) -> Position { | ty::Never | ty::Tuple(_) | ty::Projection(_) => Position::DerefStable(precedence), - ty::Infer(_) - | ty::Error(_) - | ty::Param(_) - | ty::Bound(..) - | ty::Opaque(..) - | ty::Placeholder(_) - | ty::Dynamic(..) => Position::ReborrowStable(precedence), - ty::Adt(..) if ty.has_placeholders() || ty.has_param_types_or_consts() => { - Position::ReborrowStable(precedence) - }, - ty::Adt(..) => Position::DerefStable(precedence), }; } } @@ -952,7 +952,7 @@ fn ty_contains_field(ty: Ty<'_>, name: Symbol) -> bool { } } -#[expect(clippy::needless_pass_by_value)] +#[expect(clippy::needless_pass_by_value, clippy::too_many_lines)] fn report<'tcx>(cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>, state: State, data: StateData) { match state { State::DerefMethod { diff --git a/clippy_lints/src/matches/match_same_arms.rs b/clippy_lints/src/matches/match_same_arms.rs index 16fefea5520..15513de7d86 100644 --- a/clippy_lints/src/matches/match_same_arms.rs +++ b/clippy_lints/src/matches/match_same_arms.rs @@ -285,7 +285,7 @@ fn from_pat(cx: &LateContext<'_>, arena: &'a DroplessArena, pat: &'a Pat<'_>) -> // TODO: Handle negative integers. They're currently treated as a wild match. ExprKind::Lit(lit) => match lit.node { LitKind::Str(sym, _) => Self::LitStr(sym), - LitKind::ByteStr(ref bytes) => Self::LitBytes(&**bytes), + LitKind::ByteStr(ref bytes) => Self::LitBytes(bytes), LitKind::Byte(val) => Self::LitInt(val.into()), LitKind::Char(val) => Self::LitInt(val.into()), LitKind::Int(val, _) => Self::LitInt(val), diff --git a/clippy_lints/src/matches/match_single_binding.rs b/clippy_lints/src/matches/match_single_binding.rs index 9df2db45dcf..5ae4a65acaf 100644 --- a/clippy_lints/src/matches/match_single_binding.rs +++ b/clippy_lints/src/matches/match_single_binding.rs @@ -55,7 +55,7 @@ pub(crate) fn check<'a>(cx: &LateContext<'a>, ex: &Expr<'a>, arms: &[Arm<'_>], e cx, (ex, expr), (bind_names, matched_vars), - &*snippet_body, + &snippet_body, &mut applicability, Some(span), ); @@ -88,7 +88,7 @@ pub(crate) fn check<'a>(cx: &LateContext<'a>, ex: &Expr<'a>, arms: &[Arm<'_>], e cx, (ex, expr), (bind_names, matched_vars), - &*snippet_body, + &snippet_body, &mut applicability, None, );