Skip to content

Commit eb83c07

Browse files
committed
initializer_suggestions -> lint_inconsistent_struct_field_initializers
1 parent 29c1dbd commit eb83c07

File tree

7 files changed

+24
-24
lines changed

7 files changed

+24
-24
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6249,8 +6249,8 @@ Released 2018-09-13
62496249
[`excessive-nesting-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#excessive-nesting-threshold
62506250
[`future-size-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#future-size-threshold
62516251
[`ignore-interior-mutability`]: https://doc.rust-lang.org/clippy/lint_configuration.html#ignore-interior-mutability
6252-
[`initializer-suggestions`]: https://doc.rust-lang.org/clippy/lint_configuration.html#initializer-suggestions
62536252
[`large-error-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#large-error-threshold
6253+
[`lint-inconsistent-struct-field-initializers`]: https://doc.rust-lang.org/clippy/lint_configuration.html#lint-inconsistent-struct-field-initializers
62546254
[`literal-representation-threshold`]: https://doc.rust-lang.org/clippy/lint_configuration.html#literal-representation-threshold
62556255
[`matches-for-let-else`]: https://doc.rust-lang.org/clippy/lint_configuration.html#matches-for-let-else
62566256
[`max-fn-params-bools`]: https://doc.rust-lang.org/clippy/lint_configuration.html#max-fn-params-bools

book/src/lint_configuration.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -562,7 +562,17 @@ A list of paths to types that should be treated as if they do not contain interi
562562
* [`mutable_key_type`](https://rust-lang.github.io/rust-clippy/master/index.html#mutable_key_type)
563563

564564

565-
## `initializer-suggestions`
565+
## `large-error-threshold`
566+
The maximum size of the `Err`-variant in a `Result` returned from a function
567+
568+
**Default Value:** `128`
569+
570+
---
571+
**Affected lints:**
572+
* [`result_large_err`](https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err)
573+
574+
575+
## `lint-inconsistent-struct-field-initializers`
566576
Whether to suggest reordering constructor fields when initializers are present.
567577

568578
Warnings produced by this configuration aren't necessarily fixed by just reordering the fields. Even if the
@@ -589,16 +599,6 @@ fn main() {
589599
* [`inconsistent_struct_constructor`](https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_struct_constructor)
590600

591601

592-
## `large-error-threshold`
593-
The maximum size of the `Err`-variant in a `Result` returned from a function
594-
595-
**Default Value:** `128`
596-
597-
---
598-
**Affected lints:**
599-
* [`result_large_err`](https://rust-lang.github.io/rust-clippy/master/index.html#result_large_err)
600-
601-
602602
## `literal-representation-threshold`
603603
The lower bound for linting decimal literals
604604

clippy.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
avoid-breaking-exported-api = false
22

3-
initializer-suggestions = true
3+
lint-inconsistent-struct-field-initializers = true
44

55
[[disallowed-methods]]
66
path = "rustc_lint::context::LintContext::lint"

clippy_config/src/conf.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,9 @@ define_Conf! {
526526
/// A list of paths to types that should be treated as if they do not contain interior mutability
527527
#[lints(borrow_interior_mutable_const, declare_interior_mutable_const, ifs_same_cond, mutable_key_type)]
528528
ignore_interior_mutability: Vec<String> = Vec::from(["bytes::Bytes".into()]),
529+
/// The maximum size of the `Err`-variant in a `Result` returned from a function
530+
#[lints(result_large_err)]
531+
large_error_threshold: u64 = 128,
529532
/// Whether to suggest reordering constructor fields when initializers are present.
530533
///
531534
/// Warnings produced by this configuration aren't necessarily fixed by just reordering the fields. Even if the
@@ -545,10 +548,7 @@ define_Conf! {
545548
///
546549
/// [from rust-clippy#11846]: https://github.com/rust-lang/rust-clippy/issues/11846#issuecomment-1820747924
547550
#[lints(inconsistent_struct_constructor)]
548-
initializer_suggestions: bool = false,
549-
/// The maximum size of the `Err`-variant in a `Result` returned from a function
550-
#[lints(result_large_err)]
551-
large_error_threshold: u64 = 128,
551+
lint_inconsistent_struct_field_initializers: bool = false,
552552
/// The lower bound for linting decimal literals
553553
#[lints(decimal_literal_representation)]
554554
literal_representation_threshold: u64 = 16384,

clippy_lints/src/inconsistent_struct_constructor.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,13 @@ declare_clippy_lint! {
6565
}
6666

6767
pub struct InconsistentStructConstructor {
68-
initializer_suggestions: bool,
68+
lint_inconsistent_struct_field_initializers: bool,
6969
}
7070

7171
impl InconsistentStructConstructor {
7272
pub fn new(conf: &'static Conf) -> Self {
7373
Self {
74-
initializer_suggestions: conf.initializer_suggestions,
74+
lint_inconsistent_struct_field_initializers: conf.lint_inconsistent_struct_field_initializers,
7575
}
7676
}
7777
}
@@ -86,7 +86,7 @@ impl<'tcx> LateLintPass<'tcx> for InconsistentStructConstructor {
8686
let all_fields_are_shorthand = fields.iter().all(|f| f.is_shorthand);
8787
let applicability = if all_fields_are_shorthand {
8888
Applicability::MachineApplicable
89-
} else if self.initializer_suggestions {
89+
} else if self.lint_inconsistent_struct_field_initializers {
9090
Applicability::MaybeIncorrect
9191
} else {
9292
return;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
initializer-suggestions = true
1+
lint-inconsistent-struct-field-initializers = true

tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ error: error reading Clippy's configuration file: unknown field `foobar`, expect
4444
excessive-nesting-threshold
4545
future-size-threshold
4646
ignore-interior-mutability
47-
initializer-suggestions
4847
large-error-threshold
48+
lint-inconsistent-struct-field-initializers
4949
literal-representation-threshold
5050
matches-for-let-else
5151
max-fn-params-bools
@@ -132,8 +132,8 @@ error: error reading Clippy's configuration file: unknown field `barfoo`, expect
132132
excessive-nesting-threshold
133133
future-size-threshold
134134
ignore-interior-mutability
135-
initializer-suggestions
136135
large-error-threshold
136+
lint-inconsistent-struct-field-initializers
137137
literal-representation-threshold
138138
matches-for-let-else
139139
max-fn-params-bools
@@ -220,8 +220,8 @@ error: error reading Clippy's configuration file: unknown field `allow_mixed_uni
220220
excessive-nesting-threshold
221221
future-size-threshold
222222
ignore-interior-mutability
223-
initializer-suggestions
224223
large-error-threshold
224+
lint-inconsistent-struct-field-initializers
225225
literal-representation-threshold
226226
matches-for-let-else
227227
max-fn-params-bools

0 commit comments

Comments
 (0)