Rollup merge of #5468 - Toxyxer:zero-single-char-names, r=flip1995

Zero single char names

Fixes: #4086

changelog:
- Make the inequality strict
This commit is contained in:
Philipp Krones 2020-04-15 20:12:31 +02:00 committed by GitHub
commit 19183a6af5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 6 additions and 2 deletions

View File

@ -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()

View File

@ -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

View File

@ -0,0 +1 @@
single-char-binding-names-threshold = 0

View File

@ -0,0 +1,3 @@
#![warn(clippy::many_single_char_names)]
fn main() {}