Skip to content

Commit c927912

Browse files
committed
[manual_range_patterns]: document what range we don't lint
1 parent 5cc0c04 commit c927912

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

clippy_lints/src/manual_range_patterns.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ declare_clippy_lint! {
2020
/// ### Why is this bad?
2121
/// Using an explicit range is more concise and easier to read.
2222
///
23+
/// ### Known issues
24+
/// This lint intentionally does not handle numbers greater than `i128::MAX` for `u128` literals
25+
/// in order to support negative numbers.
26+
///
2327
/// ### Example
2428
/// ```rust
2529
/// let x = 6;
@@ -43,7 +47,8 @@ fn expr_as_i128(expr: &Expr<'_>) -> Option<i128> {
4347
} else if let ExprKind::Lit(lit) = expr.kind
4448
&& let LitKind::Int(num, _) = lit.node
4549
{
46-
Some(num as i128)
50+
// Intentionally not handling numbers greater than i128::MAX (for u128 literals) for now.
51+
num.try_into().ok()
4752
} else {
4853
None
4954
}

0 commit comments

Comments
 (0)