Skip to content

Commit

Permalink
Rollup merge of #5468 - Toxyxer:zero-single-char-names, r=flip1995
Browse files Browse the repository at this point in the history
Zero single char names

Fixes: #4086

changelog:
- Make the inequality strict
  • Loading branch information
flip1995 authored Apr 15, 2020
2 parents 071a590 + ce372c1 commit 19183a6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion clippy_lints/src/non_expressive_names.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 1 addition & 1 deletion clippy_lints/src/utils/conf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions tests/ui-toml/zero_single_char_names/clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
single-char-binding-names-threshold = 0
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#![warn(clippy::many_single_char_names)]

fn main() {}

0 comments on commit 19183a6

Please sign in to comment.