File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff 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) ?,
You can’t perform that action at this time.
0 commit comments