/// **Example:**
///
/// ```rust
+ /// // Bad
/// let x: u64 = 61864918973511;
+ ///
+ /// // Good
+ /// let x: u64 = 61_864_918_973_511;
/// ```
pub UNREADABLE_LITERAL,
pedantic,
/// **Example:**
///
/// ```rust
+ /// // Probably mistyped
/// 2_32;
+ ///
+ /// // Good
+ /// 2_i32;
/// ```
pub MISTYPED_LITERAL_SUFFIXES,
correctness,
/// **Example:**
///
/// ```rust
+ /// // Bad
/// let x: u64 = 618_64_9189_73_511;
+ ///
+ /// // Good
+ /// let x: u64 = 61_864_918_973_511;
/// ```
pub INCONSISTENT_DIGIT_GROUPING,
style,
let (part, mistyped_suffixes, missing_char) = if let Some((_, exponent)) = &mut num_lit.exponent {
(exponent, &["32", "64"][..], 'f')
- } else if let Some(fraction) = &mut num_lit.fraction {
- (fraction, &["32", "64"][..], 'f')
} else {
- (&mut num_lit.integer, &["8", "16", "32", "64"][..], 'i')
+ num_lit
+ .fraction
+ .as_mut()
+ .map_or((&mut num_lit.integer, &["8", "16", "32", "64"][..], 'i'), |fraction| {
+ (fraction, &["32", "64"][..], 'f')
+ })
};
let mut split = part.rsplit('_');