Rollup merge of #5419 - dtolnay:unreadable, r=flip1995

Downgrade unreadable_literal to pedantic

As motivated by #5418. This is the top most commonly suppressed Clippy style lint, which indicates that the community has decided they don't share Clippy's opinion on the best style of this.

I've left the lint in as pedantic, though it could be that "restriction" would be better -- I can see this lint being useful as an opt-in restriction in some codebases.

changelog: Remove unreadable_literal from default set of enabled lints
This commit is contained in:
Philipp Krones 2020-04-08 15:50:23 +02:00 committed by GitHub
commit 2011d9a783
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 16 deletions

View file

@ -1105,6 +1105,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),
@ -1229,7 +1230,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),
@ -1436,7 +1436,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

@ -2301,7 +2301,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.`