File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed
Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,9 @@ 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) . or_else ( || Self :: asserted_len_from_possibly_const_expr ( cx, expr) )
129+ }
127130 pub fn asserted_len_from_int_lit_expr ( expr : & ' hir Expr < ' hir > ) -> Option < Self > {
128131 if let ExprKind :: Lit ( Spanned {
129132 node : LitKind :: Int ( Pu128 ( x) , _) ,
@@ -168,7 +171,7 @@ fn len_comparison<'hir>(
168171 if let Some ( left) = AssertionSide :: asserted_len_from_int_lit_expr ( left) {
169172 Some ( ( left, AssertionSide :: from_expr ( cx, right) ?) )
170173 } else if let Some ( left) = AssertionSide :: slice_len_from_expr ( cx, left) {
171- Some ( ( left, AssertionSide :: from_expr ( cx, right) ?) )
174+ Some ( ( left, AssertionSide :: asserted_len_from_expr ( cx, right) ?) )
172175 } else {
173176 Some ( (
174177 AssertionSide :: asserted_len_from_possibly_const_expr ( cx, left) ?,
You can’t perform that action at this time.
0 commit comments