move lint documentation into macro invocations
This commit is contained in:
parent
a8f61e70a8
commit
fe96ffeac9
132 changed files with 5405 additions and 5390 deletions
|
@ -9,95 +9,95 @@ use rustc_errors::Applicability;
|
|||
use syntax::ast::*;
|
||||
use syntax_pos;
|
||||
|
||||
/// **What it does:** Warns if a long integral or floating-point constant does
|
||||
/// not contain underscores.
|
||||
///
|
||||
/// **Why is this bad?** Reading long numbers is difficult without separators.
|
||||
///
|
||||
/// **Known problems:** None.
|
||||
///
|
||||
/// **Example:**
|
||||
///
|
||||
/// ```rust
|
||||
/// 61864918973511
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Warns if a long integral or floating-point constant does
|
||||
/// not contain underscores.
|
||||
///
|
||||
/// **Why is this bad?** Reading long numbers is difficult without separators.
|
||||
///
|
||||
/// **Known problems:** None.
|
||||
///
|
||||
/// **Example:**
|
||||
///
|
||||
/// ```rust
|
||||
/// 61864918973511
|
||||
/// ```
|
||||
pub UNREADABLE_LITERAL,
|
||||
style,
|
||||
"long integer literal without underscores"
|
||||
}
|
||||
|
||||
/// **What it does:** Warns for mistyped suffix in literals
|
||||
///
|
||||
/// **Why is this bad?** This is most probably a typo
|
||||
///
|
||||
/// **Known problems:**
|
||||
/// - Recommends a signed suffix, even though the number might be too big and an unsigned
|
||||
/// suffix is required
|
||||
/// - Does not match on `_128` since that is a valid grouping for decimal and octal numbers
|
||||
///
|
||||
/// **Example:**
|
||||
///
|
||||
/// ```rust
|
||||
/// 2_32
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Warns for mistyped suffix in literals
|
||||
///
|
||||
/// **Why is this bad?** This is most probably a typo
|
||||
///
|
||||
/// **Known problems:**
|
||||
/// - Recommends a signed suffix, even though the number might be too big and an unsigned
|
||||
/// suffix is required
|
||||
/// - Does not match on `_128` since that is a valid grouping for decimal and octal numbers
|
||||
///
|
||||
/// **Example:**
|
||||
///
|
||||
/// ```rust
|
||||
/// 2_32
|
||||
/// ```
|
||||
pub MISTYPED_LITERAL_SUFFIXES,
|
||||
correctness,
|
||||
"mistyped literal suffix"
|
||||
}
|
||||
|
||||
/// **What it does:** Warns if an integral or floating-point constant is
|
||||
/// grouped inconsistently with underscores.
|
||||
///
|
||||
/// **Why is this bad?** Readers may incorrectly interpret inconsistently
|
||||
/// grouped digits.
|
||||
///
|
||||
/// **Known problems:** None.
|
||||
///
|
||||
/// **Example:**
|
||||
///
|
||||
/// ```rust
|
||||
/// 618_64_9189_73_511
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Warns if an integral or floating-point constant is
|
||||
/// grouped inconsistently with underscores.
|
||||
///
|
||||
/// **Why is this bad?** Readers may incorrectly interpret inconsistently
|
||||
/// grouped digits.
|
||||
///
|
||||
/// **Known problems:** None.
|
||||
///
|
||||
/// **Example:**
|
||||
///
|
||||
/// ```rust
|
||||
/// 618_64_9189_73_511
|
||||
/// ```
|
||||
pub INCONSISTENT_DIGIT_GROUPING,
|
||||
style,
|
||||
"integer literals with digits grouped inconsistently"
|
||||
}
|
||||
|
||||
/// **What it does:** Warns if the digits of an integral or floating-point
|
||||
/// constant are grouped into groups that
|
||||
/// are too large.
|
||||
///
|
||||
/// **Why is this bad?** Negatively impacts readability.
|
||||
///
|
||||
/// **Known problems:** None.
|
||||
///
|
||||
/// **Example:**
|
||||
///
|
||||
/// ```rust
|
||||
/// 6186491_8973511
|
||||
/// ```
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Warns if the digits of an integral or floating-point
|
||||
/// constant are grouped into groups that
|
||||
/// are too large.
|
||||
///
|
||||
/// **Why is this bad?** Negatively impacts readability.
|
||||
///
|
||||
/// **Known problems:** None.
|
||||
///
|
||||
/// **Example:**
|
||||
///
|
||||
/// ```rust
|
||||
/// 6186491_8973511
|
||||
/// ```
|
||||
pub LARGE_DIGIT_GROUPS,
|
||||
pedantic,
|
||||
"grouping digits into groups that are too large"
|
||||
}
|
||||
|
||||
/// **What it does:** Warns if there is a better representation for a numeric literal.
|
||||
///
|
||||
/// **Why is this bad?** Especially for big powers of 2 a hexadecimal representation is more
|
||||
/// readable than a decimal representation.
|
||||
///
|
||||
/// **Known problems:** None.
|
||||
///
|
||||
/// **Example:**
|
||||
///
|
||||
/// `255` => `0xFF`
|
||||
/// `65_535` => `0xFFFF`
|
||||
/// `4_042_322_160` => `0xF0F0_F0F0`
|
||||
declare_clippy_lint! {
|
||||
/// **What it does:** Warns if there is a better representation for a numeric literal.
|
||||
///
|
||||
/// **Why is this bad?** Especially for big powers of 2 a hexadecimal representation is more
|
||||
/// readable than a decimal representation.
|
||||
///
|
||||
/// **Known problems:** None.
|
||||
///
|
||||
/// **Example:**
|
||||
///
|
||||
/// `255` => `0xFF`
|
||||
/// `65_535` => `0xFFFF`
|
||||
/// `4_042_322_160` => `0xF0F0_F0F0`
|
||||
pub DECIMAL_LITERAL_REPRESENTATION,
|
||||
restriction,
|
||||
"using decimal representation when hexadecimal would be better"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue