Skip to content

Commit fa88945

Browse files
committed
fix(multiple_inherent_impl): add lowercase config option + fix typo
1 parent b2b0a44 commit fa88945

File tree

15 files changed

+26
-25
lines changed

15 files changed

+26
-25
lines changed

book/src/lint_configuration.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,7 @@ A list of paths to types that should be treated as if they do not contain interi
674674
## `inherent-impl-lint-scope`
675675
Sets the scope at which duplicate impl blocks for the same type are linted.
676676

677-
**Default Value:** `"Crate"`
677+
**Default Value:** `"crate"`
678678

679679
---
680680
**Affected lints:**

clippy_config/src/types.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,7 @@ pub enum PubUnderscoreFieldsBehaviour {
700700
}
701701

702702
#[derive(Clone, Copy, Debug, PartialEq, Eq, Deserialize, Serialize)]
703+
#[serde(rename_all = "lowercase")]
703704
pub enum InherentImplLintScope {
704705
Crate,
705706
File,

clippy_lints/src/inherent_impl.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ declare_clippy_lint! {
1515
/// Checks for multiple inherent implementations of a struct
1616
///
1717
/// The config option controls the scope at which multiple inherent impl blocks for the same
18-
/// struct are linted, allowing values of "module" (only within the same module), "file"
19-
/// (within the same file), or "crate" (anywhere in the crate, default).
18+
/// struct are linted, allowing values of `module` (only within the same module), `file`
19+
/// (within the same file), or `crate` (anywhere in the crate, default).
2020
///
2121
/// ### Why restrict this?
2222
/// Splitting the implementation of a type makes the code harder to navigate.

tests/ui-cargo/multiple_inherent_impl/config_fail/Cargo.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
error: error reading Clippy's configuration file: unknown variant `FooBar`, expected one of `Crate`, `File`, `Module`
1+
error: error reading Clippy's configuration file: unknown variant `FooBar`, expected one of `crate`, `file`, `module`
22
--> $DIR/tests/ui-cargo/multiple_inherent_impl/config_fail/clippy.toml:1:28
33
|
44
1 | inherent-impl-lint-scope = "FooBar"

tests/ui-cargo/multiple_inherent_impl/crate_fail/Cargo.stderr

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ note: first implementation here
1111
--> src/main.rs:7:1
1212
|
1313
7 | / impl S {
14-
8 | | fn fisrt() {}
14+
8 | | fn first() {}
1515
9 | | }
1616
| |_^
1717
note: the lint level is defined here
@@ -33,7 +33,7 @@ note: first implementation here
3333
--> src/main.rs:16:1
3434
|
3535
16 | / impl T {
36-
17 | | fn fisrt() {}
36+
17 | | fn first() {}
3737
18 | | }
3838
| |_^
3939

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
inherent-impl-lint-scope = "Crate"
1+
inherent-impl-lint-scope = "crate"

tests/ui-cargo/multiple_inherent_impl/crate_fail/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ struct S;
55
struct T;
66

77
impl S {
8-
fn fisrt() {}
8+
fn first() {}
99
}
1010

1111
impl S {
@@ -14,7 +14,7 @@ impl S {
1414
}
1515

1616
impl T {
17-
fn fisrt() {}
17+
fn first() {}
1818
}
1919

2020
mod a {
@@ -29,7 +29,7 @@ mod b;
2929

3030
impl b::S {
3131
//^ Must NOT trigger
32-
fn fisrt() {}
32+
fn first() {}
3333
fn second() {}
3434
}
3535

tests/ui-cargo/multiple_inherent_impl/file_fail/Cargo.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ note: first implementation here
1111
--> src/main.rs:6:1
1212
|
1313
6 | / impl S {
14-
7 | | fn fisrt() {}
14+
7 | | fn first() {}
1515
8 | | }
1616
| |_^
1717
note: the lint level is defined here
@@ -34,7 +34,7 @@ note: first implementation here
3434
--> src/main.rs:22:5
3535
|
3636
22 | / impl S {
37-
23 | | fn fisrt() {}
37+
23 | | fn first() {}
3838
24 | | }
3939
| |_____^
4040

@@ -51,7 +51,7 @@ note: first implementation here
5151
--> src/c.rs:10:5
5252
|
5353
10 | / impl T {
54-
11 | | fn fisrt() {}
54+
11 | | fn first() {}
5555
12 | | }
5656
| |_____^
5757

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
inherent-impl-lint-scope = "File"
1+
inherent-impl-lint-scope = "file"

tests/ui-cargo/multiple_inherent_impl/file_fail/src/c.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ pub struct S;
22
struct T;
33

44
impl S {
5-
fn fisrt() {}
5+
fn first() {}
66
}
77

88
mod d {
99
use super::T;
1010
impl T {
11-
fn fisrt() {}
11+
fn first() {}
1212
}
1313
}
1414

0 commit comments

Comments
 (0)