Skip to content

Commit 5e887b2

Browse files
committed
Fix lifetime mismatch between LateContext and Ty
1 parent 3217799 commit 5e887b2

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

Diff for: clippy_lints/src/loops.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -1245,7 +1245,12 @@ fn is_len_call(expr: &Expr, var: Name) -> bool {
12451245
false
12461246
}
12471247

1248-
fn is_end_eq_array_len(cx: &LateContext<'_, '_>, end: &Expr, limits: ast::RangeLimits, indexed_ty: Ty<'_>) -> bool {
1248+
fn is_end_eq_array_len<'tcx>(
1249+
cx: &LateContext<'_, 'tcx>,
1250+
end: &Expr,
1251+
limits: ast::RangeLimits,
1252+
indexed_ty: Ty<'tcx>,
1253+
) -> bool {
12491254
if_chain! {
12501255
if let ExprKind::Lit(ref lit) = end.node;
12511256
if let ast::LitKind::Int(end_int, _) = lit.node;
@@ -1982,7 +1987,7 @@ fn is_ref_iterable_type(cx: &LateContext<'_, '_>, e: &Expr) -> bool {
19821987
match_type(cx, ty, &paths::BTREESET)
19831988
}
19841989

1985-
fn is_iterable_array(ty: Ty<'_>, cx: &LateContext<'_, '_>) -> bool {
1990+
fn is_iterable_array<'tcx>(ty: Ty<'tcx>, cx: &LateContext<'_, 'tcx>) -> bool {
19861991
// IntoIterator is currently only implemented for array sizes <= 32 in rustc
19871992
match ty.sty {
19881993
ty::Array(_, n) => (0..=32).contains(&n.assert_usize(cx.tcx).expect("array length")),

Diff for: clippy_lints/src/methods/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1773,7 +1773,7 @@ fn derefs_to_slice<'a, 'tcx>(
17731773
expr: &'tcx hir::Expr,
17741774
ty: Ty<'tcx>,
17751775
) -> Option<&'tcx hir::Expr> {
1776-
fn may_slice(cx: &LateContext<'_, '_>, ty: Ty<'_>) -> bool {
1776+
fn may_slice<'a>(cx: &LateContext<'_, 'a>, ty: Ty<'a>) -> bool {
17771777
match ty.sty {
17781778
ty::Slice(_) => true,
17791779
ty::Adt(def, _) if def.is_box() => may_slice(cx, ty.boxed_ty()),

0 commit comments

Comments
 (0)