Skip to content

Commit

Permalink
[manual_range_patterns]: document what range we don't lint
Browse files Browse the repository at this point in the history
  • Loading branch information
y21 committed Jul 7, 2023
1 parent 5cc0c04 commit c927912
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion clippy_lints/src/manual_range_patterns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ declare_clippy_lint! {
/// ### Why is this bad?
/// Using an explicit range is more concise and easier to read.
///
/// ### Known issues
/// This lint intentionally does not handle numbers greater than `i128::MAX` for `u128` literals
/// in order to support negative numbers.
///
/// ### Example
/// ```rust
/// let x = 6;
Expand All @@ -43,7 +47,8 @@ fn expr_as_i128(expr: &Expr<'_>) -> Option<i128> {
} else if let ExprKind::Lit(lit) = expr.kind
&& let LitKind::Int(num, _) = lit.node
{
Some(num as i128)
// Intentionally not handling numbers greater than i128::MAX (for u128 literals) for now.
num.try_into().ok()
} else {
None
}
Expand Down

0 comments on commit c927912

Please sign in to comment.