Downgrade unreadable_literal to pedantic

This commit is contained in:
David Tolnay 2020-04-04 12:47:16 -07:00
parent 7907abea27
commit be34bc46ed
No known key found for this signature in database
GPG key ID: F9BA143B95FF6D82
7 changed files with 21 additions and 16 deletions

View file

@ -1098,6 +1098,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&items_after_statements::ITEMS_AFTER_STATEMENTS),
LintId::of(&large_stack_arrays::LARGE_STACK_ARRAYS),
LintId::of(&literal_representation::LARGE_DIGIT_GROUPS),
LintId::of(&literal_representation::UNREADABLE_LITERAL),
LintId::of(&loops::EXPLICIT_INTO_ITER_LOOP),
LintId::of(&loops::EXPLICIT_ITER_LOOP),
LintId::of(&macro_use::MACRO_USE_IMPORTS),
@ -1219,7 +1220,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&lifetimes::NEEDLESS_LIFETIMES),
LintId::of(&literal_representation::INCONSISTENT_DIGIT_GROUPING),
LintId::of(&literal_representation::MISTYPED_LITERAL_SUFFIXES),
LintId::of(&literal_representation::UNREADABLE_LITERAL),
LintId::of(&loops::EMPTY_LOOP),
LintId::of(&loops::EXPLICIT_COUNTER_LOOP),
LintId::of(&loops::FOR_KV_MAP),
@ -1428,7 +1428,6 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
LintId::of(&len_zero::LEN_ZERO),
LintId::of(&let_if_seq::USELESS_LET_IF_SEQ),
LintId::of(&literal_representation::INCONSISTENT_DIGIT_GROUPING),
LintId::of(&literal_representation::UNREADABLE_LITERAL),
LintId::of(&loops::EMPTY_LOOP),
LintId::of(&loops::FOR_KV_MAP),
LintId::of(&loops::NEEDLESS_RANGE_LOOP),

View file

@ -27,7 +27,7 @@ declare_clippy_lint! {
/// let x: u64 = 61864918973511;
/// ```
pub UNREADABLE_LITERAL,
style,
pedantic,
"long integer literal without underscores"
}

View file

@ -2294,7 +2294,7 @@ pub static ref ALL_LINTS: Vec<Lint> = vec![
},
Lint {
name: "unreadable_literal",
group: "style",
group: "pedantic",
desc: "long integer literal without underscores",
deprecation: None,
module: "literal_representation",

View file

@ -1,5 +1,5 @@
#[warn(clippy::approx_constant)]
#[allow(unused, clippy::shadow_unrelated, clippy::similar_names, clippy::unreadable_literal)]
#[allow(unused, clippy::shadow_unrelated, clippy::similar_names)]
fn main() {
let my_e = 2.7182;
let almost_e = 2.718;

View file

@ -1,5 +1,6 @@
// run-rustfix
#[warn(clippy::inconsistent_digit_grouping)]
#[deny(clippy::unreadable_literal)]
#[allow(unused_variables, clippy::excessive_precision)]
fn main() {
macro_rules! mac1 {

View file

@ -1,5 +1,6 @@
// run-rustfix
#[warn(clippy::inconsistent_digit_grouping)]
#[deny(clippy::unreadable_literal)]
#[allow(unused_variables, clippy::excessive_precision)]
fn main() {
macro_rules! mac1 {

View file

@ -1,5 +1,5 @@
error: digits grouped inconsistently by underscores
--> $DIR/inconsistent_digit_grouping.rs:25:16
--> $DIR/inconsistent_digit_grouping.rs:26:16
|
LL | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32);
| ^^^^^^^^ help: consider: `123_456`
@ -7,57 +7,61 @@ LL | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f
= note: `-D clippy::inconsistent-digit-grouping` implied by `-D warnings`
error: digits grouped inconsistently by underscores
--> $DIR/inconsistent_digit_grouping.rs:25:26
--> $DIR/inconsistent_digit_grouping.rs:26:26
|
LL | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32);
| ^^^^^^^^^^ help: consider: `12_345_678`
error: digits grouped inconsistently by underscores
--> $DIR/inconsistent_digit_grouping.rs:25:38
--> $DIR/inconsistent_digit_grouping.rs:26:38
|
LL | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32);
| ^^^^^^^^ help: consider: `1_234_567`
error: digits grouped inconsistently by underscores
--> $DIR/inconsistent_digit_grouping.rs:25:48
--> $DIR/inconsistent_digit_grouping.rs:26:48
|
LL | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32);
| ^^^^^^^^^^^^^^ help: consider: `1_234.567_8_f32`
error: digits grouped inconsistently by underscores
--> $DIR/inconsistent_digit_grouping.rs:25:64
--> $DIR/inconsistent_digit_grouping.rs:26:64
|
LL | let bad = (1_23_456, 1_234_5678, 1234_567, 1_234.5678_f32, 1.234_5678_f32);
| ^^^^^^^^^^^^^^ help: consider: `1.234_567_8_f32`
error: long literal lacking separators
--> $DIR/inconsistent_digit_grouping.rs:28:13
--> $DIR/inconsistent_digit_grouping.rs:29:13
|
LL | let _ = 0x100000;
| ^^^^^^^^ help: consider: `0x0010_0000`
|
= note: `-D clippy::unreadable-literal` implied by `-D warnings`
note: the lint level is defined here
--> $DIR/inconsistent_digit_grouping.rs:3:8
|
LL | #[deny(clippy::unreadable_literal)]
| ^^^^^^^^^^^^^^^^^^^^^^^^^^
error: long literal lacking separators
--> $DIR/inconsistent_digit_grouping.rs:29:13
--> $DIR/inconsistent_digit_grouping.rs:30:13
|
LL | let _ = 0x1000000;
| ^^^^^^^^^ help: consider: `0x0100_0000`
error: long literal lacking separators
--> $DIR/inconsistent_digit_grouping.rs:30:13
--> $DIR/inconsistent_digit_grouping.rs:31:13
|
LL | let _ = 0x10000000;
| ^^^^^^^^^^ help: consider: `0x1000_0000`
error: long literal lacking separators
--> $DIR/inconsistent_digit_grouping.rs:31:13
--> $DIR/inconsistent_digit_grouping.rs:32:13
|
LL | let _ = 0x100000000_u64;
| ^^^^^^^^^^^^^^^ help: consider: `0x0001_0000_0000_u64`
error: digits grouped inconsistently by underscores
--> $DIR/inconsistent_digit_grouping.rs:34:18
--> $DIR/inconsistent_digit_grouping.rs:35:18
|
LL | let _: f32 = 1_23_456.;
| ^^^^^^^^^ help: consider: `123_456.`