Skip to content

Commit 0824c5d

Browse files
committed
rename enum_variants threshold and add ui-toml test
just for struct, as the enum ice is being fixed in a different branch
1 parent e22c199 commit 0824c5d

File tree

5 files changed

+11
-13
lines changed

5 files changed

+11
-13
lines changed

clippy_lints/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -846,11 +846,11 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
846846
literal_representation_threshold,
847847
))
848848
});
849-
let enum_variant_name_threshold = conf.enum_variant_name_threshold;
849+
let item_name_threshold = conf.item_name_threshold;
850850
let allow_private_module_inception = conf.allow_private_module_inception;
851851
store.register_late_pass(move |_| {
852852
Box::new(item_name_repetitions::ItemNameRepetitions::new(
853-
enum_variant_name_threshold,
853+
item_name_threshold,
854854
avoid_breaking_exported_api,
855855
allow_private_module_inception,
856856
))

clippy_lints/src/utils/conf.rs

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -356,14 +356,10 @@ define_Conf! {
356356
///
357357
/// The maximum size of objects (in bytes) that will be linted. Larger objects are ok on the heap
358358
(too_large_for_stack: u64 = 200),
359-
/// Lint: ENUM_VARIANT_NAMES.
359+
/// Lint: ENUM_VARIANT_NAMES, STRUCT_FIELD_NAMES
360360
///
361-
/// The minimum number of enum variants for the lints about variant names to trigger
362-
(enum_variant_name_threshold: u64 = 3),
363-
/// Lint: STRUCT_FIELD_NAMES.
364-
///
365-
/// The minimum number of struct fields for the lints about field names to trigger
366-
(struct_fields_name_threshold: u64 = 3),
361+
/// The minimum number of enum variants or sruct fields for the lints about variant and field names to trigger
362+
(item_name_threshold: u64 = 3),
367363
/// Lint: LARGE_ENUM_VARIANT.
368364
///
369365
/// The maximum size of an enum's variant to avoid box suggestion
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
item-name-threshold = 0
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
struct Data {}
2+
3+
fn main() {}

tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,11 @@ error: error reading Clippy's configuration file: unknown field `foobar`, expect
3131
enable-raw-pointer-heuristic-for-send
3232
enforce-iter-loop-reborrow
3333
enforced-import-renames
34-
enum-variant-name-threshold
3534
enum-variant-size-threshold
3635
excessive-nesting-threshold
3736
future-size-threshold
3837
ignore-interior-mutability
38+
item-name-threshold
3939
large-error-threshold
4040
literal-representation-threshold
4141
matches-for-let-else
@@ -53,7 +53,6 @@ error: error reading Clippy's configuration file: unknown field `foobar`, expect
5353
single-char-binding-names-threshold
5454
stack-size-threshold
5555
standard-macro-braces
56-
struct-fields-name-threshold
5756
suppress-restriction-lint-in-const
5857
third-party
5958
too-large-for-stack
@@ -105,11 +104,11 @@ error: error reading Clippy's configuration file: unknown field `barfoo`, expect
105104
enable-raw-pointer-heuristic-for-send
106105
enforce-iter-loop-reborrow
107106
enforced-import-renames
108-
enum-variant-name-threshold
109107
enum-variant-size-threshold
110108
excessive-nesting-threshold
111109
future-size-threshold
112110
ignore-interior-mutability
111+
item-name-threshold
113112
large-error-threshold
114113
literal-representation-threshold
115114
matches-for-let-else
@@ -127,7 +126,6 @@ error: error reading Clippy's configuration file: unknown field `barfoo`, expect
127126
single-char-binding-names-threshold
128127
stack-size-threshold
129128
standard-macro-braces
130-
struct-fields-name-threshold
131129
suppress-restriction-lint-in-const
132130
third-party
133131
too-large-for-stack

0 commit comments

Comments
 (0)