File tree 1 file changed +8
-6
lines changed
1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -7,20 +7,22 @@ use rustc::{declare_lint_pass, declare_tool_lint};
7
7
use rustc_errors:: Applicability ;
8
8
9
9
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.
11
11
///
12
12
/// **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.
14
14
///
15
15
/// **Example:**
16
16
/// ```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();
19
20
/// ```
20
21
/// can be written as:
21
22
/// ```
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);
24
26
/// ```
25
27
pub TO_DIGIT_IS_SOME ,
26
28
style,
You can’t perform that action at this time.
0 commit comments