Skip to content

Commit bb03a78

Browse files
committed
Move let_unit_value back into style
1 parent dde1d06 commit bb03a78

Some content is hidden

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

50 files changed

+303
-257
lines changed

clippy_lints/src/lib.register_all.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,7 @@ store.register_group(true, "clippy::all", Some("clippy_all"), vec![
302302
LintId::of(uninit_vec::UNINIT_VEC),
303303
LintId::of(unit_hash::UNIT_HASH),
304304
LintId::of(unit_return_expecting_ord::UNIT_RETURN_EXPECTING_ORD),
305+
LintId::of(unit_types::LET_UNIT_VALUE),
305306
LintId::of(unit_types::UNIT_ARG),
306307
LintId::of(unit_types::UNIT_CMP),
307308
LintId::of(unnamed_address::FN_ADDRESS_COMPARISONS),

clippy_lints/src/lib.register_pedantic.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ store.register_group(true, "clippy::pedantic", Some("clippy_pedantic"), vec![
8989
LintId::of(types::LINKEDLIST),
9090
LintId::of(types::OPTION_OPTION),
9191
LintId::of(unicode::UNICODE_NOT_NFC),
92-
LintId::of(unit_types::LET_UNIT_VALUE),
9392
LintId::of(unnecessary_wraps::UNNECESSARY_WRAPS),
9493
LintId::of(unnested_or_patterns::UNNESTED_OR_PATTERNS),
9594
LintId::of(unused_async::UNUSED_ASYNC),

clippy_lints/src/lib.register_style.rs

Lines changed: 1 addition & 0 deletions
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),

clippy_lints/src/unit_types/mod.rs

Lines changed: 1 addition & 1 deletion
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

tests/ui-internal/interning_defined_symbol.fixed

Lines changed: 1 addition & 1 deletion
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;

tests/ui-internal/interning_defined_symbol.rs

Lines changed: 1 addition & 1 deletion
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;

tests/ui-toml/functions_maxlines/test.rs

Lines changed: 1 addition & 0 deletions
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() {

tests/ui-toml/functions_maxlines/test.stderr

Lines changed: 4 additions & 4 deletions
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";

tests/ui/cast_slice_different_sizes.rs

Lines changed: 2 additions & 0 deletions
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;

tests/ui/cast_slice_different_sizes.stderr

Lines changed: 6 additions & 6 deletions
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, ..)`

0 commit comments

Comments
 (0)