Skip to content

Commit

Permalink
rename enum_variants threshold and add ui-toml test
Browse files Browse the repository at this point in the history
just for struct, as the enum ice is being fixed in a different branch
  • Loading branch information
jonboh committed Sep 24, 2023
1 parent e22c199 commit 0824c5d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions clippy_lints/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -846,11 +846,11 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
literal_representation_threshold,
))
});
let enum_variant_name_threshold = conf.enum_variant_name_threshold;
let item_name_threshold = conf.item_name_threshold;
let allow_private_module_inception = conf.allow_private_module_inception;
store.register_late_pass(move |_| {
Box::new(item_name_repetitions::ItemNameRepetitions::new(
enum_variant_name_threshold,
item_name_threshold,
avoid_breaking_exported_api,
allow_private_module_inception,
))
Expand Down
10 changes: 3 additions & 7 deletions clippy_lints/src/utils/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,14 +356,10 @@ define_Conf! {
///
/// The maximum size of objects (in bytes) that will be linted. Larger objects are ok on the heap
(too_large_for_stack: u64 = 200),
/// Lint: ENUM_VARIANT_NAMES.
/// Lint: ENUM_VARIANT_NAMES, STRUCT_FIELD_NAMES
///
/// The minimum number of enum variants for the lints about variant names to trigger
(enum_variant_name_threshold: u64 = 3),
/// Lint: STRUCT_FIELD_NAMES.
///
/// The minimum number of struct fields for the lints about field names to trigger
(struct_fields_name_threshold: u64 = 3),
/// The minimum number of enum variants or sruct fields for the lints about variant and field names to trigger
(item_name_threshold: u64 = 3),
/// Lint: LARGE_ENUM_VARIANT.
///
/// The maximum size of an enum's variant to avoid box suggestion
Expand Down
1 change: 1 addition & 0 deletions tests/ui-toml/item_name_repetitions_threshold0/clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
item-name-threshold = 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
struct Data {}

fn main() {}
6 changes: 2 additions & 4 deletions tests/ui-toml/toml_unknown_key/conf_unknown_key.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ error: error reading Clippy's configuration file: unknown field `foobar`, expect
enable-raw-pointer-heuristic-for-send
enforce-iter-loop-reborrow
enforced-import-renames
enum-variant-name-threshold
enum-variant-size-threshold
excessive-nesting-threshold
future-size-threshold
ignore-interior-mutability
item-name-threshold
large-error-threshold
literal-representation-threshold
matches-for-let-else
Expand All @@ -53,7 +53,6 @@ error: error reading Clippy's configuration file: unknown field `foobar`, expect
single-char-binding-names-threshold
stack-size-threshold
standard-macro-braces
struct-fields-name-threshold
suppress-restriction-lint-in-const
third-party
too-large-for-stack
Expand Down Expand Up @@ -105,11 +104,11 @@ error: error reading Clippy's configuration file: unknown field `barfoo`, expect
enable-raw-pointer-heuristic-for-send
enforce-iter-loop-reborrow
enforced-import-renames
enum-variant-name-threshold
enum-variant-size-threshold
excessive-nesting-threshold
future-size-threshold
ignore-interior-mutability
item-name-threshold
large-error-threshold
literal-representation-threshold
matches-for-let-else
Expand All @@ -127,7 +126,6 @@ error: error reading Clippy's configuration file: unknown field `barfoo`, expect
single-char-binding-names-threshold
stack-size-threshold
standard-macro-braces
struct-fields-name-threshold
suppress-restriction-lint-in-const
third-party
too-large-for-stack
Expand Down

0 comments on commit 0824c5d

Please sign in to comment.