From cf99f504fde3cab40e4b961281e53bbe18858829 Mon Sep 17 00:00:00 2001 From: asquared31415 <34665709+asquared31415@users.noreply.github.com> Date: Sun, 24 Apr 2022 19:41:43 -0400 Subject: [PATCH] remove extra lifetime --- clippy_lints/src/casts/cast_slice_different_sizes.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/clippy_lints/src/casts/cast_slice_different_sizes.rs b/clippy_lints/src/casts/cast_slice_different_sizes.rs index 893af60db2c5..16c9e49ff11d 100644 --- a/clippy_lints/src/casts/cast_slice_different_sizes.rs +++ b/clippy_lints/src/casts/cast_slice_different_sizes.rs @@ -8,7 +8,7 @@ use rustc_semver::RustcVersion; use super::CAST_SLICE_DIFFERENT_SIZES; -pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, msrv: &Option) { +pub(super) fn check<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>, msrv: &Option) { // suggestion is invalid if `ptr::slice_from_raw_parts` does not exist if !meets_msrv(msrv.as_ref(), &msrvs::PTR_SLICE_RAW_PARTS) { return; @@ -102,21 +102,20 @@ fn get_raw_slice_ty_mut(ty: Ty<'_>) -> Option> { } } -struct CastChainInfo<'expr, 'tcx> { +struct CastChainInfo<'tcx> { /// The left most part of the cast chain, or in other words, the first cast in the chain /// Used for diagnostics - left_cast: &'expr Expr<'expr>, + left_cast: &'tcx Expr<'tcx>, /// The starting type of the cast chain start_ty: TypeAndMut<'tcx>, /// The final type of the cast chain end_ty: TypeAndMut<'tcx>, } -// FIXME(asquared31415): unbounded recursion linear with the number of casts in an expression /// Returns a `CastChainInfo` with the left-most cast in the chain and the original ptr T and final /// ptr U if the expression is composed of casts. /// Returns None if the expr is not a Cast -fn expr_cast_chain_tys<'tcx, 'expr>(cx: &LateContext<'tcx>, expr: &Expr<'expr>) -> Option> { +fn expr_cast_chain_tys<'tcx>(cx: &LateContext<'tcx>, expr: &Expr<'tcx>) -> Option> { if let ExprKind::Cast(cast_expr, _cast_to_hir_ty) = expr.peel_blocks().kind { let cast_to = cx.typeck_results().expr_ty(expr); let to_slice_ty = get_raw_slice_ty_mut(cast_to)?;