Skip to content

Commit 9aefae4

Browse files
author
Michael Wright
committed
Fix to_digit_is_some documentation
1 parent a9b5b36 commit 9aefae4

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

clippy_lints/src/to_digit_is_some.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -7,20 +7,22 @@ use rustc::{declare_lint_pass, declare_tool_lint};
77
use rustc_errors::Applicability;
88

99
declare_clippy_lint! {
10-
/// **What it does:** Checks for `.to_digit().is_some()` on `char`s.
10+
/// **What it does:** Checks for `.to_digit(..).is_some()` on `char`s.
1111
///
1212
/// **Why is this bad?** This is a convoluted way of checking if a `char` is a digit. It's
13-
/// more straight forward use the dedicated `is_digit` method.
13+
/// more straight forward to use the dedicated `is_digit` method.
1414
///
1515
/// **Example:**
1616
/// ```rust
17-
/// # let x: char = 'x'
18-
/// let is_digit = x.to_digit().is_some();
17+
/// # let c = 'c';
18+
/// # let radix = 10;
19+
/// let is_digit = c.to_digit(10).is_some();
1920
/// ```
2021
/// can be written as:
2122
/// ```
22-
/// # let x: char = 'x'
23-
/// let is_digit = x.is_digit();
23+
/// # let c = 'c';
24+
/// # let radix = 10;
25+
/// let is_digit = c.is_digit(radix);
2426
/// ```
2527
pub TO_DIGIT_IS_SOME,
2628
style,

0 commit comments

Comments
 (0)