Skip to content

Commit b087cc1

Browse files
committed
fix mistake
1 parent 139e905 commit b087cc1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

clippy_lints/src/missing_asserts_for_indexing.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,10 @@ impl<'hir> AssertionSide<'hir> {
124124
None
125125
}
126126
}
127+
pub fn asserted_len_from_expr(cx: &LateContext<'_>, expr: &'hir Expr<'hir>) -> Option<Self> {
128+
Self::asserted_len_from_int_lit_expr(expr)
129+
.or_else(|| Self::asserted_len_from_possibly_const_expr(cx, expr))
130+
}
127131
pub fn asserted_len_from_int_lit_expr(expr: &'hir Expr<'hir>) -> Option<Self> {
128132
if let ExprKind::Lit(Spanned {
129133
node: LitKind::Int(Pu128(x), _),
@@ -168,7 +172,7 @@ fn len_comparison<'hir>(
168172
if let Some(left) = AssertionSide::asserted_len_from_int_lit_expr(left) {
169173
Some((left, AssertionSide::from_expr(cx, right)?))
170174
} else if let Some(left) = AssertionSide::slice_len_from_expr(cx, left) {
171-
Some((left, AssertionSide::from_expr(cx, right)?))
175+
Some((left, AssertionSide::asserted_len_from_expr(cx, right)?))
172176
} else {
173177
Some((
174178
AssertionSide::asserted_len_from_possibly_const_expr(cx, left)?,

0 commit comments

Comments
 (0)