Skip to content

Commit ff0e654

Browse files
committed
Move let_unit_value back into style
1 parent 080e310 commit ff0e654

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+306
-258
lines changed

Diff for: clippy_lints/src/lib.register_all.rs

+1
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,7 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![
299299
LintId::of(uninit_vec::UNINIT_VEC),
300300
LintId::of(unit_hash::UNIT_HASH),
301301
LintId::of(unit_return_expecting_ord::UNIT_RETURN_EXPECTING_ORD),
302+
LintId::of(unit_types::LET_UNIT_VALUE),
302303
LintId::of(unit_types::UNIT_ARG),
303304
LintId::of(unit_types::UNIT_CMP),
304305
LintId::of(unnamed_address::FN_ADDRESS_COMPARISONS),

Diff for: clippy_lints/src/lib.register_pedantic.rs

-1
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@ store.register_group(true, "clippy::pedantic", Some("clippy_pedantic"), vec![
8888
LintId::of(types::LINKEDLIST),
8989
LintId::of(types::OPTION_OPTION),
9090
LintId::of(unicode::UNICODE_NOT_NFC),
91-
LintId::of(unit_types::LET_UNIT_VALUE),
9291
LintId::of(unnecessary_wraps::UNNECESSARY_WRAPS),
9392
LintId::of(unnested_or_patterns::UNNESTED_OR_PATTERNS),
9493
LintId::of(unused_async::UNUSED_ASYNC),

Diff for: clippy_lints/src/lib.register_style.rs

+1
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ store.register_group(true, "clippy::style", Some("clippy_style"), vec![
105105
LintId::of(single_component_path_imports::SINGLE_COMPONENT_PATH_IMPORTS),
106106
LintId::of(tabs_in_doc_comments::TABS_IN_DOC_COMMENTS),
107107
LintId::of(to_digit_is_some::TO_DIGIT_IS_SOME),
108+
LintId::of(unit_types::LET_UNIT_VALUE),
108109
LintId::of(unsafe_removed_from_name::UNSAFE_REMOVED_FROM_NAME),
109110
LintId::of(unused_unit::UNUSED_UNIT),
110111
LintId::of(upper_case_acronyms::UPPER_CASE_ACRONYMS),

Diff for: clippy_lints/src/unit_types/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ declare_clippy_lint! {
2323
/// ```
2424
#[clippy::version = "pre 1.29.0"]
2525
pub LET_UNIT_VALUE,
26-
pedantic,
26+
style,
2727
"creating a `let` binding to a value of unit type, which usually can't be used afterwards"
2828
}
2929

Diff for: tests/ui-internal/interning_defined_symbol.fixed

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// run-rustfix
22
#![deny(clippy::internal)]
3-
#![allow(clippy::missing_clippy_version_attribute)]
3+
#![allow(clippy::missing_clippy_version_attribute, clippy::let_unit_value)]
44
#![feature(rustc_private)]
55

66
extern crate rustc_span;

Diff for: tests/ui-internal/interning_defined_symbol.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// run-rustfix
22
#![deny(clippy::internal)]
3-
#![allow(clippy::missing_clippy_version_attribute)]
3+
#![allow(clippy::missing_clippy_version_attribute, clippy::let_unit_value)]
44
#![feature(rustc_private)]
55

66
extern crate rustc_span;

Diff for: tests/ui-toml/functions_maxlines/test.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![warn(clippy::too_many_lines)]
2+
#![allow(clippy::let_unit_value)]
23

34
// This function should be considered one line.
45
fn many_comments_but_one_line_of_code() {

Diff for: tests/ui-toml/functions_maxlines/test.stderr

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
error: this function has too many lines (2/1)
2-
--> $DIR/test.rs:18:1
2+
--> $DIR/test.rs:19:1
33
|
44
LL | / fn too_many_lines() {
55
LL | | println!("This is bad.");
@@ -10,7 +10,7 @@ LL | | }
1010
= note: `-D clippy::too-many-lines` implied by `-D warnings`
1111

1212
error: this function has too many lines (4/1)
13-
--> $DIR/test.rs:24:1
13+
--> $DIR/test.rs:25:1
1414
|
1515
LL | / async fn async_too_many_lines() {
1616
LL | | println!("This is bad.");
@@ -19,7 +19,7 @@ LL | | }
1919
| |_^
2020

2121
error: this function has too many lines (4/1)
22-
--> $DIR/test.rs:30:1
22+
--> $DIR/test.rs:31:1
2323
|
2424
LL | / fn closure_too_many_lines() {
2525
LL | | let _ = {
@@ -30,7 +30,7 @@ LL | | }
3030
| |_^
3131

3232
error: this function has too many lines (2/1)
33-
--> $DIR/test.rs:52:1
33+
--> $DIR/test.rs:53:1
3434
|
3535
LL | / fn comment_before_code() {
3636
LL | | let _ = "test";

Diff for: tests/ui/cast_slice_different_sizes.rs

+2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#![allow(clippy::let_unit_value)]
2+
13
fn main() {
24
let x: [i32; 3] = [1_i32, 2, 3];
35
let r_x = &x;

Diff for: tests/ui/cast_slice_different_sizes.stderr

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
11
error: casting between raw pointers to `[i32]` (element size 4) and `[u8]` (element size 1) does not adjust the count
2-
--> $DIR/cast_slice_different_sizes.rs:7:13
2+
--> $DIR/cast_slice_different_sizes.rs:9:13
33
|
44
LL | let b = a as *const [u8];
55
| ^^^^^^^^^^^^^^^^ help: replace with `ptr::slice_from_raw_parts`: `core::ptr::slice_from_raw_parts(a as *const u8, ..)`
66
|
77
= note: `#[deny(clippy::cast_slice_different_sizes)]` on by default
88

99
error: casting between raw pointers to `[u8]` (element size 1) and `[u32]` (element size 4) does not adjust the count
10-
--> $DIR/cast_slice_different_sizes.rs:8:13
10+
--> $DIR/cast_slice_different_sizes.rs:10:13
1111
|
1212
LL | let c = b as *const [u32];
1313
| ^^^^^^^^^^^^^^^^^ help: replace with `ptr::slice_from_raw_parts`: `core::ptr::slice_from_raw_parts(b as *const u32, ..)`
1414

1515
error: casting between raw pointers to `[i32]` (element size 4) and `[u8]` (element size 1) does not adjust the count
16-
--> $DIR/cast_slice_different_sizes.rs:11:16
16+
--> $DIR/cast_slice_different_sizes.rs:13:16
1717
|
1818
LL | let loss = r_x as *const [i32] as *const [u8];
1919
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with `ptr::slice_from_raw_parts`: `core::ptr::slice_from_raw_parts(r_x as *const [i32] as *const u8, ..)`
2020

2121
error: casting between raw pointers to `[i32]` (element size 4) and `[u8]` (element size 1) does not adjust the count
22-
--> $DIR/cast_slice_different_sizes.rs:18:24
22+
--> $DIR/cast_slice_different_sizes.rs:20:24
2323
|
2424
LL | let loss_block_1 = { r_x as *const [i32] } as *const [u8];
2525
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with `ptr::slice_from_raw_parts`: `core::ptr::slice_from_raw_parts({ r_x as *const [i32] } as *const u8, ..)`
2626

2727
error: casting between raw pointers to `[i32]` (element size 4) and `[u8]` (element size 1) does not adjust the count
28-
--> $DIR/cast_slice_different_sizes.rs:19:24
28+
--> $DIR/cast_slice_different_sizes.rs:21:24
2929
|
3030
LL | let loss_block_2 = {
3131
| ________________________^
@@ -43,7 +43,7 @@ LL ~ } as *const u8, ..);
4343
|
4444

4545
error: casting between raw pointers to `[i32]` (element size 4) and `[u8]` (element size 1) does not adjust the count
46-
--> $DIR/cast_slice_different_sizes.rs:36:27
46+
--> $DIR/cast_slice_different_sizes.rs:38:27
4747
|
4848
LL | let long_chain_loss = r_x as *const [i32] as *const [u32] as *const [u16] as *const [i8] as *const [u8];
4949
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: replace with `ptr::slice_from_raw_parts`: `core::ptr::slice_from_raw_parts(r_x as *const [i32] as *const [u32] as *const [u16] as *const [i8] as *const u8, ..)`

Diff for: tests/ui/crashes/ice-5944.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#![warn(clippy::repeat_once)]
2+
#![allow(clippy::let_unit_value)]
23

34
trait Repeat {
45
fn repeat(&self) {}

Diff for: tests/ui/default_numeric_fallback_f64.fixed

+9-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
// aux-build:macro_rules.rs
33

44
#![warn(clippy::default_numeric_fallback)]
5-
#![allow(unused)]
6-
#![allow(clippy::never_loop)]
7-
#![allow(clippy::no_effect)]
8-
#![allow(clippy::unnecessary_operation)]
9-
#![allow(clippy::branches_sharing_code)]
10-
#![allow(clippy::match_single_binding)]
5+
#![allow(
6+
unused,
7+
clippy::never_loop,
8+
clippy::no_effect,
9+
clippy::unnecessary_operation,
10+
clippy::branches_sharing_code,
11+
clippy::match_single_binding,
12+
clippy::let_unit_value
13+
)]
1114

1215
#[macro_use]
1316
extern crate macro_rules;

Diff for: tests/ui/default_numeric_fallback_f64.rs

+9-6
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22
// aux-build:macro_rules.rs
33

44
#![warn(clippy::default_numeric_fallback)]
5-
#![allow(unused)]
6-
#![allow(clippy::never_loop)]
7-
#![allow(clippy::no_effect)]
8-
#![allow(clippy::unnecessary_operation)]
9-
#![allow(clippy::branches_sharing_code)]
10-
#![allow(clippy::match_single_binding)]
5+
#![allow(
6+
unused,
7+
clippy::never_loop,
8+
clippy::no_effect,
9+
clippy::unnecessary_operation,
10+
clippy::branches_sharing_code,
11+
clippy::match_single_binding,
12+
clippy::let_unit_value
13+
)]
1114

1215
#[macro_use]
1316
extern crate macro_rules;

Diff for: tests/ui/default_numeric_fallback_f64.stderr

+23-23
Original file line numberDiff line numberDiff line change
@@ -1,139 +1,139 @@
11
error: default numeric fallback might occur
2-
--> $DIR/default_numeric_fallback_f64.rs:18:17
2+
--> $DIR/default_numeric_fallback_f64.rs:21:17
33
|
44
LL | let x = 0.12;
55
| ^^^^ help: consider adding suffix: `0.12_f64`
66
|
77
= note: `-D clippy::default-numeric-fallback` implied by `-D warnings`
88

99
error: default numeric fallback might occur
10-
--> $DIR/default_numeric_fallback_f64.rs:19:18
10+
--> $DIR/default_numeric_fallback_f64.rs:22:18
1111
|
1212
LL | let x = [1., 2., 3.];
1313
| ^^ help: consider adding suffix: `1.0_f64`
1414

1515
error: default numeric fallback might occur
16-
--> $DIR/default_numeric_fallback_f64.rs:19:22
16+
--> $DIR/default_numeric_fallback_f64.rs:22:22
1717
|
1818
LL | let x = [1., 2., 3.];
1919
| ^^ help: consider adding suffix: `2.0_f64`
2020

2121
error: default numeric fallback might occur
22-
--> $DIR/default_numeric_fallback_f64.rs:19:26
22+
--> $DIR/default_numeric_fallback_f64.rs:22:26
2323
|
2424
LL | let x = [1., 2., 3.];
2525
| ^^ help: consider adding suffix: `3.0_f64`
2626

2727
error: default numeric fallback might occur
28-
--> $DIR/default_numeric_fallback_f64.rs:20:28
28+
--> $DIR/default_numeric_fallback_f64.rs:23:28
2929
|
3030
LL | let x = if true { (1., 2.) } else { (3., 4.) };
3131
| ^^ help: consider adding suffix: `1.0_f64`
3232

3333
error: default numeric fallback might occur
34-
--> $DIR/default_numeric_fallback_f64.rs:20:32
34+
--> $DIR/default_numeric_fallback_f64.rs:23:32
3535
|
3636
LL | let x = if true { (1., 2.) } else { (3., 4.) };
3737
| ^^ help: consider adding suffix: `2.0_f64`
3838

3939
error: default numeric fallback might occur
40-
--> $DIR/default_numeric_fallback_f64.rs:20:46
40+
--> $DIR/default_numeric_fallback_f64.rs:23:46
4141
|
4242
LL | let x = if true { (1., 2.) } else { (3., 4.) };
4343
| ^^ help: consider adding suffix: `3.0_f64`
4444

4545
error: default numeric fallback might occur
46-
--> $DIR/default_numeric_fallback_f64.rs:20:50
46+
--> $DIR/default_numeric_fallback_f64.rs:23:50
4747
|
4848
LL | let x = if true { (1., 2.) } else { (3., 4.) };
4949
| ^^ help: consider adding suffix: `4.0_f64`
5050

5151
error: default numeric fallback might occur
52-
--> $DIR/default_numeric_fallback_f64.rs:21:23
52+
--> $DIR/default_numeric_fallback_f64.rs:24:23
5353
|
5454
LL | let x = match 1. {
5555
| ^^ help: consider adding suffix: `1.0_f64`
5656

5757
error: default numeric fallback might occur
58-
--> $DIR/default_numeric_fallback_f64.rs:22:18
58+
--> $DIR/default_numeric_fallback_f64.rs:25:18
5959
|
6060
LL | _ => 1.,
6161
| ^^ help: consider adding suffix: `1.0_f64`
6262

6363
error: default numeric fallback might occur
64-
--> $DIR/default_numeric_fallback_f64.rs:40:21
64+
--> $DIR/default_numeric_fallback_f64.rs:43:21
6565
|
6666
LL | let y = 1.;
6767
| ^^ help: consider adding suffix: `1.0_f64`
6868

6969
error: default numeric fallback might occur
70-
--> $DIR/default_numeric_fallback_f64.rs:48:21
70+
--> $DIR/default_numeric_fallback_f64.rs:51:21
7171
|
7272
LL | let y = 1.;
7373
| ^^ help: consider adding suffix: `1.0_f64`
7474

7575
error: default numeric fallback might occur
76-
--> $DIR/default_numeric_fallback_f64.rs:54:21
76+
--> $DIR/default_numeric_fallback_f64.rs:57:21
7777
|
7878
LL | let y = 1.;
7979
| ^^ help: consider adding suffix: `1.0_f64`
8080

8181
error: default numeric fallback might occur
82-
--> $DIR/default_numeric_fallback_f64.rs:66:9
82+
--> $DIR/default_numeric_fallback_f64.rs:69:9
8383
|
8484
LL | 1.
8585
| ^^ help: consider adding suffix: `1.0_f64`
8686

8787
error: default numeric fallback might occur
88-
--> $DIR/default_numeric_fallback_f64.rs:72:27
88+
--> $DIR/default_numeric_fallback_f64.rs:75:27
8989
|
9090
LL | let f = || -> _ { 1. };
9191
| ^^ help: consider adding suffix: `1.0_f64`
9292

9393
error: default numeric fallback might occur
94-
--> $DIR/default_numeric_fallback_f64.rs:76:29
94+
--> $DIR/default_numeric_fallback_f64.rs:79:29
9595
|
9696
LL | let f = || -> f64 { 1. };
9797
| ^^ help: consider adding suffix: `1.0_f64`
9898

9999
error: default numeric fallback might occur
100-
--> $DIR/default_numeric_fallback_f64.rs:90:21
100+
--> $DIR/default_numeric_fallback_f64.rs:93:21
101101
|
102102
LL | generic_arg(1.);
103103
| ^^ help: consider adding suffix: `1.0_f64`
104104

105105
error: default numeric fallback might occur
106-
--> $DIR/default_numeric_fallback_f64.rs:93:32
106+
--> $DIR/default_numeric_fallback_f64.rs:96:32
107107
|
108108
LL | let x: _ = generic_arg(1.);
109109
| ^^ help: consider adding suffix: `1.0_f64`
110110

111111
error: default numeric fallback might occur
112-
--> $DIR/default_numeric_fallback_f64.rs:111:28
112+
--> $DIR/default_numeric_fallback_f64.rs:114:28
113113
|
114114
LL | GenericStruct { x: 1. };
115115
| ^^ help: consider adding suffix: `1.0_f64`
116116

117117
error: default numeric fallback might occur
118-
--> $DIR/default_numeric_fallback_f64.rs:114:36
118+
--> $DIR/default_numeric_fallback_f64.rs:117:36
119119
|
120120
LL | let _ = GenericStruct { x: 1. };
121121
| ^^ help: consider adding suffix: `1.0_f64`
122122

123123
error: default numeric fallback might occur
124-
--> $DIR/default_numeric_fallback_f64.rs:132:24
124+
--> $DIR/default_numeric_fallback_f64.rs:135:24
125125
|
126126
LL | GenericEnum::X(1.);
127127
| ^^ help: consider adding suffix: `1.0_f64`
128128

129129
error: default numeric fallback might occur
130-
--> $DIR/default_numeric_fallback_f64.rs:152:23
130+
--> $DIR/default_numeric_fallback_f64.rs:155:23
131131
|
132132
LL | s.generic_arg(1.);
133133
| ^^ help: consider adding suffix: `1.0_f64`
134134

135135
error: default numeric fallback might occur
136-
--> $DIR/default_numeric_fallback_f64.rs:159:21
136+
--> $DIR/default_numeric_fallback_f64.rs:162:21
137137
|
138138
LL | let x = 22.;
139139
| ^^^ help: consider adding suffix: `22.0_f64`

Diff for: tests/ui/default_numeric_fallback_i32.fixed

+8-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
// aux-build:macro_rules.rs
33

44
#![warn(clippy::default_numeric_fallback)]
5-
#![allow(unused)]
6-
#![allow(clippy::never_loop)]
7-
#![allow(clippy::no_effect)]
8-
#![allow(clippy::unnecessary_operation)]
9-
#![allow(clippy::branches_sharing_code)]
5+
#![allow(
6+
unused,
7+
clippy::never_loop,
8+
clippy::no_effect,
9+
clippy::unnecessary_operation,
10+
clippy::branches_sharing_code,
11+
clippy::let_unit_value
12+
)]
1013

1114
#[macro_use]
1215
extern crate macro_rules;

Diff for: tests/ui/default_numeric_fallback_i32.rs

+8-5
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@
22
// aux-build:macro_rules.rs
33

44
#![warn(clippy::default_numeric_fallback)]
5-
#![allow(unused)]
6-
#![allow(clippy::never_loop)]
7-
#![allow(clippy::no_effect)]
8-
#![allow(clippy::unnecessary_operation)]
9-
#![allow(clippy::branches_sharing_code)]
5+
#![allow(
6+
unused,
7+
clippy::never_loop,
8+
clippy::no_effect,
9+
clippy::unnecessary_operation,
10+
clippy::branches_sharing_code,
11+
clippy::let_unit_value
12+
)]
1013

1114
#[macro_use]
1215
extern crate macro_rules;

0 commit comments

Comments
 (0)