diff --git a/clippy_lints/src/non_expressive_names.rs b/clippy_lints/src/non_expressive_names.rs index 98446eef9d73..45809b359866 100644 --- a/clippy_lints/src/non_expressive_names.rs +++ b/clippy_lints/src/non_expressive_names.rs @@ -93,7 +93,7 @@ impl<'a, 'tcx> SimilarNamesLocalVisitor<'a, 'tcx> { fn check_single_char_names(&self) { let num_single_char_names = self.single_char_names.iter().flatten().count(); let threshold = self.lint.single_char_binding_names_threshold; - if num_single_char_names as u64 >= threshold { + if num_single_char_names as u64 > threshold { let span = self .single_char_names .iter() diff --git a/clippy_lints/src/utils/conf.rs b/clippy_lints/src/utils/conf.rs index afcfe34f5be8..4b81ff33495c 100644 --- a/clippy_lints/src/utils/conf.rs +++ b/clippy_lints/src/utils/conf.rs @@ -135,7 +135,7 @@ define_Conf! { /// Lint: TYPE_COMPLEXITY. The maximum complexity a type can have (type_complexity_threshold, "type_complexity_threshold": u64, 250), /// Lint: MANY_SINGLE_CHAR_NAMES. The maximum number of single char bindings a scope may have - (single_char_binding_names_threshold, "single_char_binding_names_threshold": u64, 5), + (single_char_binding_names_threshold, "single_char_binding_names_threshold": u64, 4), /// Lint: BOXED_LOCAL. The maximum size of objects (in bytes) that will be linted. Larger objects are ok on the heap (too_large_for_stack, "too_large_for_stack": u64, 200), /// Lint: ENUM_VARIANT_NAMES. The minimum number of enum variants for the lints about variant names to trigger diff --git a/tests/ui-toml/zero_single_char_names/clippy.toml b/tests/ui-toml/zero_single_char_names/clippy.toml new file mode 100644 index 000000000000..42a1067b95ed --- /dev/null +++ b/tests/ui-toml/zero_single_char_names/clippy.toml @@ -0,0 +1 @@ +single-char-binding-names-threshold = 0 diff --git a/tests/ui-toml/zero_single_char_names/zero_single_char_names.rs b/tests/ui-toml/zero_single_char_names/zero_single_char_names.rs new file mode 100644 index 000000000000..22aaa242b9b9 --- /dev/null +++ b/tests/ui-toml/zero_single_char_names/zero_single_char_names.rs @@ -0,0 +1,3 @@ +#![warn(clippy::many_single_char_names)] + +fn main() {}