mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-26 13:54:06 +00:00
Fix to_digit_is_some
documentation
This commit is contained in:
parent
a9b5b36769
commit
9aefae4226
@ -7,20 +7,22 @@ use rustc::{declare_lint_pass, declare_tool_lint};
|
|||||||
use rustc_errors::Applicability;
|
use rustc_errors::Applicability;
|
||||||
|
|
||||||
declare_clippy_lint! {
|
declare_clippy_lint! {
|
||||||
/// **What it does:** Checks for `.to_digit().is_some()` on `char`s.
|
/// **What it does:** Checks for `.to_digit(..).is_some()` on `char`s.
|
||||||
///
|
///
|
||||||
/// **Why is this bad?** This is a convoluted way of checking if a `char` is a digit. It's
|
/// **Why is this bad?** This is a convoluted way of checking if a `char` is a digit. It's
|
||||||
/// more straight forward use the dedicated `is_digit` method.
|
/// more straight forward to use the dedicated `is_digit` method.
|
||||||
///
|
///
|
||||||
/// **Example:**
|
/// **Example:**
|
||||||
/// ```rust
|
/// ```rust
|
||||||
/// # let x: char = 'x'
|
/// # let c = 'c';
|
||||||
/// let is_digit = x.to_digit().is_some();
|
/// # let radix = 10;
|
||||||
|
/// let is_digit = c.to_digit(10).is_some();
|
||||||
/// ```
|
/// ```
|
||||||
/// can be written as:
|
/// can be written as:
|
||||||
/// ```
|
/// ```
|
||||||
/// # let x: char = 'x'
|
/// # let c = 'c';
|
||||||
/// let is_digit = x.is_digit();
|
/// # let radix = 10;
|
||||||
|
/// let is_digit = c.is_digit(radix);
|
||||||
/// ```
|
/// ```
|
||||||
pub TO_DIGIT_IS_SOME,
|
pub TO_DIGIT_IS_SOME,
|
||||||
style,
|
style,
|
||||||
|
Loading…
Reference in New Issue
Block a user