From e9e0a7e3bd0619626ad03db4b641a368d3555bcc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sat, 26 Jan 2019 20:40:55 +0100 Subject: [PATCH 1/4] rustup https://github.com/rust-lang/rust/pull/57726 --- clippy_lints/src/approx_const.rs | 4 ++ clippy_lints/src/arithmetic.rs | 4 ++ clippy_lints/src/assertions_on_constants.rs | 4 ++ clippy_lints/src/assign_ops.rs | 4 ++ clippy_lints/src/attrs.rs | 8 ++++ clippy_lints/src/bit_mask.rs | 3 ++ clippy_lints/src/blacklisted_name.rs | 3 ++ clippy_lints/src/block_in_if_condition.rs | 4 ++ clippy_lints/src/booleans.rs | 4 ++ clippy_lints/src/bytecount.rs | 4 ++ clippy_lints/src/cargo_common_metadata.rs | 4 ++ clippy_lints/src/collapsible_if.rs | 4 ++ clippy_lints/src/const_static_lifetime.rs | 4 ++ clippy_lints/src/copies.rs | 4 ++ clippy_lints/src/copy_iterator.rs | 4 ++ clippy_lints/src/cyclomatic_complexity.rs | 4 ++ clippy_lints/src/default_trait_access.rs | 4 ++ clippy_lints/src/derive.rs | 4 ++ clippy_lints/src/doc.rs | 4 ++ clippy_lints/src/double_comparison.rs | 4 ++ clippy_lints/src/double_parens.rs | 4 ++ clippy_lints/src/drop_forget_ref.rs | 4 ++ clippy_lints/src/duration_subsec.rs | 4 ++ clippy_lints/src/else_if_without_else.rs | 4 ++ clippy_lints/src/empty_enum.rs | 4 ++ clippy_lints/src/entry.rs | 4 ++ clippy_lints/src/enum_clike.rs | 4 ++ clippy_lints/src/enum_glob_use.rs | 4 ++ clippy_lints/src/enum_variants.rs | 4 ++ clippy_lints/src/eq_op.rs | 4 ++ clippy_lints/src/erasing_op.rs | 4 ++ clippy_lints/src/escape.rs | 4 ++ clippy_lints/src/eta_reduction.rs | 4 ++ clippy_lints/src/eval_order_dependence.rs | 4 ++ clippy_lints/src/excessive_precision.rs | 4 ++ clippy_lints/src/explicit_write.rs | 4 ++ clippy_lints/src/fallible_impl_from.rs | 4 ++ clippy_lints/src/format.rs | 4 ++ clippy_lints/src/formatting.rs | 4 ++ clippy_lints/src/functions.rs | 4 ++ clippy_lints/src/identity_conversion.rs | 4 ++ clippy_lints/src/identity_op.rs | 4 ++ clippy_lints/src/if_not_else.rs | 4 ++ clippy_lints/src/implicit_return.rs | 4 ++ clippy_lints/src/indexing_slicing.rs | 4 ++ .../src/infallible_destructuring_match.rs | 4 ++ clippy_lints/src/infinite_iter.rs | 4 ++ clippy_lints/src/inherent_impl.rs | 4 ++ clippy_lints/src/inline_fn_without_body.rs | 4 ++ clippy_lints/src/int_plus_one.rs | 4 ++ clippy_lints/src/invalid_ref.rs | 4 ++ clippy_lints/src/items_after_statements.rs | 4 ++ clippy_lints/src/large_enum_variant.rs | 4 ++ clippy_lints/src/len_zero.rs | 4 ++ clippy_lints/src/let_if_seq.rs | 4 ++ clippy_lints/src/lib.rs | 13 ++++-- clippy_lints/src/lifetimes.rs | 4 ++ clippy_lints/src/literal_representation.rs | 8 ++++ clippy_lints/src/loops.rs | 4 ++ clippy_lints/src/map_clone.rs | 4 ++ clippy_lints/src/map_unit_fn.rs | 4 ++ clippy_lints/src/matches.rs | 4 ++ clippy_lints/src/mem_discriminant.rs | 4 ++ clippy_lints/src/mem_forget.rs | 4 ++ clippy_lints/src/mem_replace.rs | 4 ++ clippy_lints/src/methods/mod.rs | 4 ++ clippy_lints/src/minmax.rs | 4 ++ clippy_lints/src/misc.rs | 4 ++ clippy_lints/src/misc_early.rs | 4 ++ clippy_lints/src/missing_doc.rs | 4 ++ clippy_lints/src/missing_inline.rs | 4 ++ clippy_lints/src/multiple_crate_versions.rs | 4 ++ clippy_lints/src/mut_mut.rs | 4 ++ clippy_lints/src/mut_reference.rs | 4 ++ clippy_lints/src/mutex_atomic.rs | 4 ++ clippy_lints/src/needless_bool.rs | 8 ++++ clippy_lints/src/needless_borrow.rs | 4 ++ clippy_lints/src/needless_borrowed_ref.rs | 4 ++ clippy_lints/src/needless_continue.rs | 4 ++ clippy_lints/src/needless_pass_by_value.rs | 4 ++ clippy_lints/src/needless_update.rs | 4 ++ clippy_lints/src/neg_cmp_op_on_partial_ord.rs | 4 ++ clippy_lints/src/neg_multiply.rs | 4 ++ clippy_lints/src/new_without_default.rs | 4 ++ clippy_lints/src/no_effect.rs | 4 ++ clippy_lints/src/non_copy_const.rs | 4 ++ clippy_lints/src/non_expressive_names.rs | 4 ++ clippy_lints/src/ok_if_let.rs | 4 ++ clippy_lints/src/open_options.rs | 4 ++ .../src/overflow_check_conditional.rs | 4 ++ clippy_lints/src/panic_unimplemented.rs | 4 ++ clippy_lints/src/partialeq_ne_impl.rs | 4 ++ clippy_lints/src/precedence.rs | 4 ++ clippy_lints/src/ptr.rs | 4 ++ clippy_lints/src/ptr_offset_with_cast.rs | 4 ++ clippy_lints/src/question_mark.rs | 4 ++ clippy_lints/src/ranges.rs | 4 ++ clippy_lints/src/redundant_clone.rs | 4 ++ clippy_lints/src/redundant_field_names.rs | 4 ++ .../src/redundant_pattern_matching.rs | 4 ++ clippy_lints/src/reference.rs | 8 ++++ clippy_lints/src/regex.rs | 4 ++ clippy_lints/src/replace_consts.rs | 4 ++ clippy_lints/src/returns.rs | 4 ++ clippy_lints/src/serde_api.rs | 4 ++ clippy_lints/src/shadow.rs | 4 ++ .../src/slow_vector_initialization.rs | 4 ++ clippy_lints/src/strings.rs | 8 ++++ clippy_lints/src/suspicious_trait_impl.rs | 4 ++ clippy_lints/src/swap.rs | 4 ++ clippy_lints/src/temporary_assignment.rs | 4 ++ clippy_lints/src/transmute.rs | 4 ++ .../src/trivially_copy_pass_by_ref.rs | 4 ++ clippy_lints/src/types.rs | 44 +++++++++++++++++++ clippy_lints/src/unicode.rs | 4 ++ clippy_lints/src/unsafe_removed_from_name.rs | 4 ++ clippy_lints/src/unused_io_amount.rs | 4 ++ clippy_lints/src/unused_label.rs | 4 ++ clippy_lints/src/unwrap.rs | 4 ++ clippy_lints/src/use_self.rs | 4 ++ clippy_lints/src/utils/author.rs | 4 ++ clippy_lints/src/utils/inspector.rs | 4 ++ clippy_lints/src/utils/internal_lints.rs | 15 +++++++ clippy_lints/src/vec.rs | 4 ++ clippy_lints/src/wildcard_dependencies.rs | 4 ++ clippy_lints/src/write.rs | 4 ++ clippy_lints/src/zero_div_zero.rs | 4 ++ src/driver.rs | 2 +- tests/ui/lint_without_lint_pass.rs | 4 ++ 129 files changed, 588 insertions(+), 4 deletions(-) diff --git a/clippy_lints/src/approx_const.rs b/clippy_lints/src/approx_const.rs index 8410408312fb..337139e1b1dc 100644 --- a/clippy_lints/src/approx_const.rs +++ b/clippy_lints/src/approx_const.rs @@ -60,6 +60,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(APPROX_CONSTANT) } + + fn name(&self) -> &'static str { + "ApproxConstant" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/arithmetic.rs b/clippy_lints/src/arithmetic.rs index efa53ff94c39..e14c79374ba4 100644 --- a/clippy_lints/src/arithmetic.rs +++ b/clippy_lints/src/arithmetic.rs @@ -52,6 +52,10 @@ impl LintPass for Arithmetic { fn get_lints(&self) -> LintArray { lint_array!(INTEGER_ARITHMETIC, FLOAT_ARITHMETIC) } + + fn name(&self) -> &'static str { + "Arithmetic" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Arithmetic { diff --git a/clippy_lints/src/assertions_on_constants.rs b/clippy_lints/src/assertions_on_constants.rs index a148cb1c3a6f..d420de3a4dbe 100644 --- a/clippy_lints/src/assertions_on_constants.rs +++ b/clippy_lints/src/assertions_on_constants.rs @@ -34,6 +34,10 @@ impl LintPass for AssertionsOnConstants { fn get_lints(&self) -> LintArray { lint_array![ASSERTIONS_ON_CONSTANTS] } + + fn name(&self) -> &'static str { + "AssertionsOnConstants" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssertionsOnConstants { diff --git a/clippy_lints/src/assign_ops.rs b/clippy_lints/src/assign_ops.rs index ad77ee3a3fa8..329bab5cf1ca 100644 --- a/clippy_lints/src/assign_ops.rs +++ b/clippy_lints/src/assign_ops.rs @@ -57,6 +57,10 @@ impl LintPass for AssignOps { fn get_lints(&self) -> LintArray { lint_array!(ASSIGN_OP_PATTERN, MISREFACTORED_ASSIGN_OP) } + + fn name(&self) -> &'static str { + "AssignOps" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps { diff --git a/clippy_lints/src/attrs.rs b/clippy_lints/src/attrs.rs index 9e4dd52c4143..4a5eb378d5a1 100644 --- a/clippy_lints/src/attrs.rs +++ b/clippy_lints/src/attrs.rs @@ -199,6 +199,10 @@ impl LintPass for AttrPass { UNKNOWN_CLIPPY_LINTS, ) } + + fn name(&self) -> &'static str { + "Attributes" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass { @@ -500,6 +504,10 @@ impl LintPass for CfgAttrPass { fn get_lints(&self) -> LintArray { lint_array!(DEPRECATED_CFG_ATTR,) } + + fn name(&self) -> &'static str { + "DeprecatedCfgAttribute" + } } impl EarlyLintPass for CfgAttrPass { diff --git a/clippy_lints/src/bit_mask.rs b/clippy_lints/src/bit_mask.rs index b08d9961d25d..ef0943875d20 100644 --- a/clippy_lints/src/bit_mask.rs +++ b/clippy_lints/src/bit_mask.rs @@ -108,6 +108,9 @@ impl LintPass for BitMask { fn get_lints(&self) -> LintArray { lint_array!(BAD_BIT_MASK, INEFFECTIVE_BIT_MASK, VERBOSE_BIT_MASK) } + fn name(&self) -> &'static str { + "BitMask" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BitMask { diff --git a/clippy_lints/src/blacklisted_name.rs b/clippy_lints/src/blacklisted_name.rs index 64b3be8f3027..9606b2eda327 100644 --- a/clippy_lints/src/blacklisted_name.rs +++ b/clippy_lints/src/blacklisted_name.rs @@ -37,6 +37,9 @@ impl LintPass for BlackListedName { fn get_lints(&self) -> LintArray { lint_array!(BLACKLISTED_NAME) } + fn name(&self) -> &'static str { + "BlacklistedName" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BlackListedName { diff --git a/clippy_lints/src/block_in_if_condition.rs b/clippy_lints/src/block_in_if_condition.rs index 6e850931e6ba..8abcfb4cfd6f 100644 --- a/clippy_lints/src/block_in_if_condition.rs +++ b/clippy_lints/src/block_in_if_condition.rs @@ -49,6 +49,10 @@ impl LintPass for BlockInIfCondition { fn get_lints(&self) -> LintArray { lint_array!(BLOCK_IN_IF_CONDITION_EXPR, BLOCK_IN_IF_CONDITION_STMT) } + + fn name(&self) -> &'static str { + "BlockInIfCondition" + } } struct ExVisitor<'a, 'tcx: 'a> { diff --git a/clippy_lints/src/booleans.rs b/clippy_lints/src/booleans.rs index 8b1a56e3b6ee..6b53dd908de9 100644 --- a/clippy_lints/src/booleans.rs +++ b/clippy_lints/src/booleans.rs @@ -58,6 +58,10 @@ impl LintPass for NonminimalBool { fn get_lints(&self) -> LintArray { lint_array!(NONMINIMAL_BOOL, LOGIC_BUG) } + + fn name(&self) -> &'static str { + "NonminimalBool" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonminimalBool { diff --git a/clippy_lints/src/bytecount.rs b/clippy_lints/src/bytecount.rs index 794b43f4db5c..b677ef71583b 100644 --- a/clippy_lints/src/bytecount.rs +++ b/clippy_lints/src/bytecount.rs @@ -38,6 +38,10 @@ impl LintPass for ByteCount { fn get_lints(&self) -> LintArray { lint_array!(NAIVE_BYTECOUNT) } + + fn name(&self) -> &'static str { + "ByteCount" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ByteCount { diff --git a/clippy_lints/src/cargo_common_metadata.rs b/clippy_lints/src/cargo_common_metadata.rs index c60d10cd0092..124b11cc78c6 100644 --- a/clippy_lints/src/cargo_common_metadata.rs +++ b/clippy_lints/src/cargo_common_metadata.rs @@ -62,6 +62,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(CARGO_COMMON_METADATA) } + + fn name(&self) -> &'static str { + "CargoCommonMetadata" + } } impl EarlyLintPass for Pass { diff --git a/clippy_lints/src/collapsible_if.rs b/clippy_lints/src/collapsible_if.rs index 10cbc9e6ccd4..c236706f02fb 100644 --- a/clippy_lints/src/collapsible_if.rs +++ b/clippy_lints/src/collapsible_if.rs @@ -78,6 +78,10 @@ impl LintPass for CollapsibleIf { fn get_lints(&self) -> LintArray { lint_array!(COLLAPSIBLE_IF) } + + fn name(&self) -> &'static str { + "CollapsibleIf" + } } impl EarlyLintPass for CollapsibleIf { diff --git a/clippy_lints/src/const_static_lifetime.rs b/clippy_lints/src/const_static_lifetime.rs index 229a411ce06a..7315184c8bd4 100644 --- a/clippy_lints/src/const_static_lifetime.rs +++ b/clippy_lints/src/const_static_lifetime.rs @@ -32,6 +32,10 @@ impl LintPass for StaticConst { fn get_lints(&self) -> LintArray { lint_array!(CONST_STATIC_LIFETIME) } + + fn name(&self) -> &'static str { + "StaticConst" + } } impl StaticConst { diff --git a/clippy_lints/src/copies.rs b/clippy_lints/src/copies.rs index 3676519adc13..6bb75cf8064e 100644 --- a/clippy_lints/src/copies.rs +++ b/clippy_lints/src/copies.rs @@ -110,6 +110,10 @@ impl LintPass for CopyAndPaste { fn get_lints(&self) -> LintArray { lint_array![IFS_SAME_COND, IF_SAME_THEN_ELSE, MATCH_SAME_ARMS] } + + fn name(&self) -> &'static str { + "CopyAndPaste" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CopyAndPaste { diff --git a/clippy_lints/src/copy_iterator.rs b/clippy_lints/src/copy_iterator.rs index 3d0df7424f12..59eef9e39dce 100644 --- a/clippy_lints/src/copy_iterator.rs +++ b/clippy_lints/src/copy_iterator.rs @@ -35,6 +35,10 @@ impl LintPass for CopyIterator { fn get_lints(&self) -> LintArray { lint_array![COPY_ITERATOR] } + + fn name(&self) -> &'static str { + "CopyIterator" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CopyIterator { diff --git a/clippy_lints/src/cyclomatic_complexity.rs b/clippy_lints/src/cyclomatic_complexity.rs index 9170f1e8ecf4..c6358aed4bdb 100644 --- a/clippy_lints/src/cyclomatic_complexity.rs +++ b/clippy_lints/src/cyclomatic_complexity.rs @@ -42,6 +42,10 @@ impl LintPass for CyclomaticComplexity { fn get_lints(&self) -> LintArray { lint_array!(CYCLOMATIC_COMPLEXITY) } + + fn name(&self) -> &'static str { + "CyclomaticComplexity" + } } impl CyclomaticComplexity { diff --git a/clippy_lints/src/default_trait_access.rs b/clippy_lints/src/default_trait_access.rs index c4b39dc0f0ad..7b3899b2f499 100644 --- a/clippy_lints/src/default_trait_access.rs +++ b/clippy_lints/src/default_trait_access.rs @@ -35,6 +35,10 @@ impl LintPass for DefaultTraitAccess { fn get_lints(&self) -> LintArray { lint_array!(DEFAULT_TRAIT_ACCESS) } + + fn name(&self) -> &'static str { + "DefaultTraitAccess" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DefaultTraitAccess { diff --git a/clippy_lints/src/derive.rs b/clippy_lints/src/derive.rs index a2bf0098ab84..9580fbbe4c14 100644 --- a/clippy_lints/src/derive.rs +++ b/clippy_lints/src/derive.rs @@ -68,6 +68,10 @@ impl LintPass for Derive { fn get_lints(&self) -> LintArray { lint_array!(EXPL_IMPL_CLONE_ON_COPY, DERIVE_HASH_XOR_EQ) } + + fn name(&self) -> &'static str { + "Derive" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Derive { diff --git a/clippy_lints/src/doc.rs b/clippy_lints/src/doc.rs index e96ef9ac6219..87135fb88b66 100644 --- a/clippy_lints/src/doc.rs +++ b/clippy_lints/src/doc.rs @@ -48,6 +48,10 @@ impl LintPass for Doc { fn get_lints(&self) -> LintArray { lint_array![DOC_MARKDOWN] } + + fn name(&self) -> &'static str { + "DocMarkdown" + } } impl EarlyLintPass for Doc { diff --git a/clippy_lints/src/double_comparison.rs b/clippy_lints/src/double_comparison.rs index fc4af438d44d..6c6b53b0b98d 100644 --- a/clippy_lints/src/double_comparison.rs +++ b/clippy_lints/src/double_comparison.rs @@ -37,6 +37,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(DOUBLE_COMPARISONS) } + + fn name(&self) -> &'static str { + "DoubleComparisons" + } } impl<'a, 'tcx> Pass { diff --git a/clippy_lints/src/double_parens.rs b/clippy_lints/src/double_parens.rs index 38381b069f07..71b2f5f51a7b 100644 --- a/clippy_lints/src/double_parens.rs +++ b/clippy_lints/src/double_parens.rs @@ -29,6 +29,10 @@ impl LintPass for DoubleParens { fn get_lints(&self) -> LintArray { lint_array!(DOUBLE_PARENS) } + + fn name(&self) -> &'static str { + "DoubleParens" + } } impl EarlyLintPass for DoubleParens { diff --git a/clippy_lints/src/drop_forget_ref.rs b/clippy_lints/src/drop_forget_ref.rs index 4a2a38f6ea12..b437d6030059 100644 --- a/clippy_lints/src/drop_forget_ref.rs +++ b/clippy_lints/src/drop_forget_ref.rs @@ -112,6 +112,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(DROP_REF, FORGET_REF, DROP_COPY, FORGET_COPY) } + + fn name(&self) -> &'static str { + "DropForgetRef" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/duration_subsec.rs b/clippy_lints/src/duration_subsec.rs index 3ac98c716447..3935099fdcea 100644 --- a/clippy_lints/src/duration_subsec.rs +++ b/clippy_lints/src/duration_subsec.rs @@ -36,6 +36,10 @@ impl LintPass for DurationSubsec { fn get_lints(&self) -> LintArray { lint_array!(DURATION_SUBSEC) } + + fn name(&self) -> &'static str { + "DurationSubsec" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DurationSubsec { diff --git a/clippy_lints/src/else_if_without_else.rs b/clippy_lints/src/else_if_without_else.rs index f633d81764b5..c01ad486484c 100644 --- a/clippy_lints/src/else_if_without_else.rs +++ b/clippy_lints/src/else_if_without_else.rs @@ -46,6 +46,10 @@ impl LintPass for ElseIfWithoutElse { fn get_lints(&self) -> LintArray { lint_array!(ELSE_IF_WITHOUT_ELSE) } + + fn name(&self) -> &'static str { + "ElseIfWithoutElse" + } } impl EarlyLintPass for ElseIfWithoutElse { diff --git a/clippy_lints/src/empty_enum.rs b/clippy_lints/src/empty_enum.rs index 71e84bf1b472..ab80625f6852 100644 --- a/clippy_lints/src/empty_enum.rs +++ b/clippy_lints/src/empty_enum.rs @@ -30,6 +30,10 @@ impl LintPass for EmptyEnum { fn get_lints(&self) -> LintArray { lint_array!(EMPTY_ENUM) } + + fn name(&self) -> &'static str { + "EmptyEnum" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EmptyEnum { diff --git a/clippy_lints/src/entry.rs b/clippy_lints/src/entry.rs index 646a2569bbe1..8de881d0425b 100644 --- a/clippy_lints/src/entry.rs +++ b/clippy_lints/src/entry.rs @@ -44,6 +44,10 @@ impl LintPass for HashMapLint { fn get_lints(&self) -> LintArray { lint_array!(MAP_ENTRY) } + + fn name(&self) -> &'static str { + "HashMap" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for HashMapLint { diff --git a/clippy_lints/src/enum_clike.rs b/clippy_lints/src/enum_clike.rs index ab9bc6cd0ca7..46501d554978 100644 --- a/clippy_lints/src/enum_clike.rs +++ b/clippy_lints/src/enum_clike.rs @@ -40,6 +40,10 @@ impl LintPass for UnportableVariant { fn get_lints(&self) -> LintArray { lint_array!(ENUM_CLIKE_UNPORTABLE_VARIANT) } + + fn name(&self) -> &'static str { + "UnportableVariant" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnportableVariant { diff --git a/clippy_lints/src/enum_glob_use.rs b/clippy_lints/src/enum_glob_use.rs index 9402c2a5aad3..4806736682f1 100644 --- a/clippy_lints/src/enum_glob_use.rs +++ b/clippy_lints/src/enum_glob_use.rs @@ -32,6 +32,10 @@ impl LintPass for EnumGlobUse { fn get_lints(&self) -> LintArray { lint_array!(ENUM_GLOB_USE) } + + fn name(&self) -> &'static str { + "EnumGlobUse" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EnumGlobUse { diff --git a/clippy_lints/src/enum_variants.rs b/clippy_lints/src/enum_variants.rs index ffaa8b2811a0..74d61c0f6a0d 100644 --- a/clippy_lints/src/enum_variants.rs +++ b/clippy_lints/src/enum_variants.rs @@ -124,6 +124,10 @@ impl LintPass for EnumVariantNames { MODULE_INCEPTION ) } + + fn name(&self) -> &'static str { + "EnumVariantNames" + } } fn var2str(var: &Variant) -> LocalInternedString { diff --git a/clippy_lints/src/eq_op.rs b/clippy_lints/src/eq_op.rs index 93132534a767..38c9a05b44c6 100644 --- a/clippy_lints/src/eq_op.rs +++ b/clippy_lints/src/eq_op.rs @@ -52,6 +52,10 @@ impl LintPass for EqOp { fn get_lints(&self) -> LintArray { lint_array!(EQ_OP, OP_REF) } + + fn name(&self) -> &'static str { + "EqOp" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp { diff --git a/clippy_lints/src/erasing_op.rs b/clippy_lints/src/erasing_op.rs index fea318555437..a1d851377eb2 100644 --- a/clippy_lints/src/erasing_op.rs +++ b/clippy_lints/src/erasing_op.rs @@ -32,6 +32,10 @@ impl LintPass for ErasingOp { fn get_lints(&self) -> LintArray { lint_array!(ERASING_OP) } + + fn name(&self) -> &'static str { + "ErasingOp" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ErasingOp { diff --git a/clippy_lints/src/escape.rs b/clippy_lints/src/escape.rs index a7b47fd1e546..a276579b1b5b 100644 --- a/clippy_lints/src/escape.rs +++ b/clippy_lints/src/escape.rs @@ -52,6 +52,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(BOXED_LOCAL) } + + fn name(&self) -> &'static str { + "BoxedLocal" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/eta_reduction.rs b/clippy_lints/src/eta_reduction.rs index 624d215492f1..cc86aee7defa 100644 --- a/clippy_lints/src/eta_reduction.rs +++ b/clippy_lints/src/eta_reduction.rs @@ -36,6 +36,10 @@ impl LintPass for EtaPass { fn get_lints(&self) -> LintArray { lint_array!(REDUNDANT_CLOSURE) } + + fn name(&self) -> &'static str { + "EtaReduction" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EtaPass { diff --git a/clippy_lints/src/eval_order_dependence.rs b/clippy_lints/src/eval_order_dependence.rs index 2b4b0d402392..8c933ef74d24 100644 --- a/clippy_lints/src/eval_order_dependence.rs +++ b/clippy_lints/src/eval_order_dependence.rs @@ -61,6 +61,10 @@ impl LintPass for EvalOrderDependence { fn get_lints(&self) -> LintArray { lint_array!(EVAL_ORDER_DEPENDENCE, DIVERGING_SUB_EXPRESSION) } + + fn name(&self) -> &'static str { + "EvalOrderDependence" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EvalOrderDependence { diff --git a/clippy_lints/src/excessive_precision.rs b/clippy_lints/src/excessive_precision.rs index f17b82ab33d4..27e033f688da 100644 --- a/clippy_lints/src/excessive_precision.rs +++ b/clippy_lints/src/excessive_precision.rs @@ -41,6 +41,10 @@ impl LintPass for ExcessivePrecision { fn get_lints(&self) -> LintArray { lint_array!(EXCESSIVE_PRECISION) } + + fn name(&self) -> &'static str { + "ExcessivePrecision" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ExcessivePrecision { diff --git a/clippy_lints/src/explicit_write.rs b/clippy_lints/src/explicit_write.rs index 0bbc85a0416a..2be2bb058bbc 100644 --- a/clippy_lints/src/explicit_write.rs +++ b/clippy_lints/src/explicit_write.rs @@ -31,6 +31,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(EXPLICIT_WRITE) } + + fn name(&self) -> &'static str { + "ExplicitWrite" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/fallible_impl_from.rs b/clippy_lints/src/fallible_impl_from.rs index 2d11b3bd9474..3669e8998a4c 100644 --- a/clippy_lints/src/fallible_impl_from.rs +++ b/clippy_lints/src/fallible_impl_from.rs @@ -34,6 +34,10 @@ impl LintPass for FallibleImplFrom { fn get_lints(&self) -> LintArray { lint_array!(FALLIBLE_IMPL_FROM) } + + fn name(&self) -> &'static str { + "FallibleImpleFrom" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for FallibleImplFrom { diff --git a/clippy_lints/src/format.rs b/clippy_lints/src/format.rs index 90e19af15d07..f14c281fcc98 100644 --- a/clippy_lints/src/format.rs +++ b/clippy_lints/src/format.rs @@ -40,6 +40,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array![USELESS_FORMAT] } + + fn name(&self) -> &'static str { + "UselessFormat" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/formatting.rs b/clippy_lints/src/formatting.rs index 6459e7b81c6e..ecc6f9565d05 100644 --- a/clippy_lints/src/formatting.rs +++ b/clippy_lints/src/formatting.rs @@ -89,6 +89,10 @@ impl LintPass for Formatting { POSSIBLE_MISSING_COMMA ) } + + fn name(&self) -> &'static str { + "Formatting" + } } impl EarlyLintPass for Formatting { diff --git a/clippy_lints/src/functions.rs b/clippy_lints/src/functions.rs index a2b7d31b183a..cb69e96c8e48 100644 --- a/clippy_lints/src/functions.rs +++ b/clippy_lints/src/functions.rs @@ -74,6 +74,10 @@ impl LintPass for Functions { fn get_lints(&self) -> LintArray { lint_array!(TOO_MANY_ARGUMENTS, NOT_UNSAFE_PTR_ARG_DEREF) } + + fn name(&self) -> &'static str { + "Functions" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Functions { diff --git a/clippy_lints/src/identity_conversion.rs b/clippy_lints/src/identity_conversion.rs index d0e1ee577486..2c0e389119fe 100644 --- a/clippy_lints/src/identity_conversion.rs +++ b/clippy_lints/src/identity_conversion.rs @@ -34,6 +34,10 @@ impl LintPass for IdentityConversion { fn get_lints(&self) -> LintArray { lint_array!(IDENTITY_CONVERSION) } + + fn name(&self) -> &'static str { + "IdentityConversion" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IdentityConversion { diff --git a/clippy_lints/src/identity_op.rs b/clippy_lints/src/identity_op.rs index 862c289fce1d..89d41c796298 100644 --- a/clippy_lints/src/identity_op.rs +++ b/clippy_lints/src/identity_op.rs @@ -30,6 +30,10 @@ impl LintPass for IdentityOp { fn get_lints(&self) -> LintArray { lint_array!(IDENTITY_OP) } + + fn name(&self) -> &'static str { + "IdentityOp" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IdentityOp { diff --git a/clippy_lints/src/if_not_else.rs b/clippy_lints/src/if_not_else.rs index 19554c7e2072..38213141de3f 100644 --- a/clippy_lints/src/if_not_else.rs +++ b/clippy_lints/src/if_not_else.rs @@ -44,6 +44,10 @@ impl LintPass for IfNotElse { fn get_lints(&self) -> LintArray { lint_array!(IF_NOT_ELSE) } + + fn name(&self) -> &'static str { + "IfNotElse" + } } impl EarlyLintPass for IfNotElse { diff --git a/clippy_lints/src/implicit_return.rs b/clippy_lints/src/implicit_return.rs index 073c37eefc5a..b25b3bce652b 100644 --- a/clippy_lints/src/implicit_return.rs +++ b/clippy_lints/src/implicit_return.rs @@ -114,6 +114,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(IMPLICIT_RETURN) } + + fn name(&self) -> &'static str { + "ImplicitReturn" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/indexing_slicing.rs b/clippy_lints/src/indexing_slicing.rs index b4893c759c88..19e2283dc076 100644 --- a/clippy_lints/src/indexing_slicing.rs +++ b/clippy_lints/src/indexing_slicing.rs @@ -91,6 +91,10 @@ impl LintPass for IndexingSlicing { fn get_lints(&self) -> LintArray { lint_array!(INDEXING_SLICING, OUT_OF_BOUNDS_INDEXING) } + + fn name(&self) -> &'static str { + "IndexSlicing" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IndexingSlicing { diff --git a/clippy_lints/src/infallible_destructuring_match.rs b/clippy_lints/src/infallible_destructuring_match.rs index 5d0c5a4a79dd..704b583f8138 100644 --- a/clippy_lints/src/infallible_destructuring_match.rs +++ b/clippy_lints/src/infallible_destructuring_match.rs @@ -47,6 +47,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(INFALLIBLE_DESTRUCTURING_MATCH) } + + fn name(&self) -> &'static str { + "InfallibleDestructingMatch" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/infinite_iter.rs b/clippy_lints/src/infinite_iter.rs index c25c4ec488fe..9f2bcd487877 100644 --- a/clippy_lints/src/infinite_iter.rs +++ b/clippy_lints/src/infinite_iter.rs @@ -45,6 +45,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(INFINITE_ITER, MAYBE_INFINITE_ITER) } + + fn name(&self) -> &'static str { + "InfiniteIter" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/inherent_impl.rs b/clippy_lints/src/inherent_impl.rs index 52aa73d7a103..5585ce4cbefe 100644 --- a/clippy_lints/src/inherent_impl.rs +++ b/clippy_lints/src/inherent_impl.rs @@ -56,6 +56,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(MULTIPLE_INHERENT_IMPL) } + + fn name(&self) -> &'static str { + "MultipleInherientImpl" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/inline_fn_without_body.rs b/clippy_lints/src/inline_fn_without_body.rs index a092f86658b9..bdc17ab46244 100644 --- a/clippy_lints/src/inline_fn_without_body.rs +++ b/clippy_lints/src/inline_fn_without_body.rs @@ -35,6 +35,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(INLINE_FN_WITHOUT_BODY) } + + fn name(&self) -> &'static str { + "InlineFnWithoutBody" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/int_plus_one.rs b/clippy_lints/src/int_plus_one.rs index 547052f34295..aee3b7cc5423 100644 --- a/clippy_lints/src/int_plus_one.rs +++ b/clippy_lints/src/int_plus_one.rs @@ -36,6 +36,10 @@ impl LintPass for IntPlusOne { fn get_lints(&self) -> LintArray { lint_array!(INT_PLUS_ONE) } + + fn name(&self) -> &'static str { + "IntPlusOne" + } } // cases: diff --git a/clippy_lints/src/invalid_ref.rs b/clippy_lints/src/invalid_ref.rs index 03b099b4393a..90649535958c 100644 --- a/clippy_lints/src/invalid_ref.rs +++ b/clippy_lints/src/invalid_ref.rs @@ -32,6 +32,10 @@ impl LintPass for InvalidRef { fn get_lints(&self) -> LintArray { lint_array!(INVALID_REF) } + + fn name(&self) -> &'static str { + "InvalidRef" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for InvalidRef { diff --git a/clippy_lints/src/items_after_statements.rs b/clippy_lints/src/items_after_statements.rs index 0af8c3dd5cb2..dd283d897a56 100644 --- a/clippy_lints/src/items_after_statements.rs +++ b/clippy_lints/src/items_after_statements.rs @@ -40,6 +40,10 @@ impl LintPass for ItemsAfterStatements { fn get_lints(&self) -> LintArray { lint_array!(ITEMS_AFTER_STATEMENTS) } + + fn name(&self) -> &'static str { + "ItemsAfterStatements" + } } impl EarlyLintPass for ItemsAfterStatements { diff --git a/clippy_lints/src/large_enum_variant.rs b/clippy_lints/src/large_enum_variant.rs index d5bc2a8fad75..0b3cf07e50ae 100644 --- a/clippy_lints/src/large_enum_variant.rs +++ b/clippy_lints/src/large_enum_variant.rs @@ -46,6 +46,10 @@ impl LintPass for LargeEnumVariant { fn get_lints(&self) -> LintArray { lint_array!(LARGE_ENUM_VARIANT) } + + fn name(&self) -> &'static str { + "LargeEnumVariant" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LargeEnumVariant { diff --git a/clippy_lints/src/len_zero.rs b/clippy_lints/src/len_zero.rs index b15ba5a47838..2764cd6ffd9b 100644 --- a/clippy_lints/src/len_zero.rs +++ b/clippy_lints/src/len_zero.rs @@ -77,6 +77,10 @@ impl LintPass for LenZero { fn get_lints(&self) -> LintArray { lint_array!(LEN_ZERO, LEN_WITHOUT_IS_EMPTY) } + + fn name(&self) -> &'static str { + "LenZero" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LenZero { diff --git a/clippy_lints/src/let_if_seq.rs b/clippy_lints/src/let_if_seq.rs index 5154c6d4d08e..3eb25cfb36ad 100644 --- a/clippy_lints/src/let_if_seq.rs +++ b/clippy_lints/src/let_if_seq.rs @@ -60,6 +60,10 @@ impl LintPass for LetIfSeq { fn get_lints(&self) -> LintArray { lint_array!(USELESS_LET_IF_SEQ) } + + fn name(&self) -> &'static str { + "LetIfSeq" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LetIfSeq { diff --git a/clippy_lints/src/lib.rs b/clippy_lints/src/lib.rs index 9d77c3c64a2a..4683d353ccf8 100644 --- a/clippy_lints/src/lib.rs +++ b/clippy_lints/src/lib.rs @@ -212,15 +212,22 @@ pub fn register_pre_expansion_lints( store: &mut rustc::lint::LintStore, conf: &Conf, ) { - store.register_pre_expansion_pass(Some(session), box write::Pass); - store.register_pre_expansion_pass(Some(session), box redundant_field_names::RedundantFieldNames); + store.register_pre_expansion_pass(Some(session), true, false, box write::Pass); store.register_pre_expansion_pass( Some(session), + true, + false, + box redundant_field_names::RedundantFieldNames, + ); + store.register_pre_expansion_pass( + Some(session), + true, + false, box non_expressive_names::NonExpressiveNames { single_char_binding_names_threshold: conf.single_char_binding_names_threshold, }, ); - store.register_pre_expansion_pass(Some(session), box attrs::CfgAttrPass); + store.register_pre_expansion_pass(Some(session), true, false, box attrs::CfgAttrPass); } pub fn read_conf(reg: &rustc_plugin::Registry<'_>) -> Conf { diff --git a/clippy_lints/src/lifetimes.rs b/clippy_lints/src/lifetimes.rs index f7512446c87f..5562d750dace 100644 --- a/clippy_lints/src/lifetimes.rs +++ b/clippy_lints/src/lifetimes.rs @@ -61,6 +61,10 @@ impl LintPass for LifetimePass { fn get_lints(&self) -> LintArray { lint_array!(NEEDLESS_LIFETIMES, EXTRA_UNUSED_LIFETIMES) } + + fn name(&self) -> &'static str { + "LifeTimes" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LifetimePass { diff --git a/clippy_lints/src/literal_representation.rs b/clippy_lints/src/literal_representation.rs index d6e6ffa61b31..801e54f055c4 100644 --- a/clippy_lints/src/literal_representation.rs +++ b/clippy_lints/src/literal_representation.rs @@ -346,6 +346,10 @@ impl LintPass for LiteralDigitGrouping { MISTYPED_LITERAL_SUFFIXES, ) } + + fn name(&self) -> &'static str { + "LiteralDigitGrouping" + } } impl EarlyLintPass for LiteralDigitGrouping { @@ -493,6 +497,10 @@ impl LintPass for LiteralRepresentation { fn get_lints(&self) -> LintArray { lint_array!(DECIMAL_LITERAL_REPRESENTATION) } + + fn name(&self) -> &'static str { + "DecimalLiteralRepresentation" + } } impl EarlyLintPass for LiteralRepresentation { diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs index 70ff86087ea6..64e76c09989e 100644 --- a/clippy_lints/src/loops.rs +++ b/clippy_lints/src/loops.rs @@ -465,6 +465,10 @@ impl LintPass for Pass { WHILE_IMMUTABLE_CONDITION, ) } + + fn name(&self) -> &'static str { + "Loops" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/map_clone.rs b/clippy_lints/src/map_clone.rs index 4db0ca759db8..49bd8f650e56 100644 --- a/clippy_lints/src/map_clone.rs +++ b/clippy_lints/src/map_clone.rs @@ -46,6 +46,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(MAP_CLONE) } + + fn name(&self) -> &'static str { + "MapClone" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/map_unit_fn.rs b/clippy_lints/src/map_unit_fn.rs index ad5761f5f04a..bd4b40438248 100644 --- a/clippy_lints/src/map_unit_fn.rs +++ b/clippy_lints/src/map_unit_fn.rs @@ -81,6 +81,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(OPTION_MAP_UNIT_FN, RESULT_MAP_UNIT_FN) } + + fn name(&self) -> &'static str { + "MapUnit" + } } fn is_unit_type(ty: ty::Ty<'_>) -> bool { diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index b003da44236f..adb8dab5c427 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -202,6 +202,10 @@ impl LintPass for MatchPass { MATCH_AS_REF ) } + + fn name(&self) -> &'static str { + "Matches" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MatchPass { diff --git a/clippy_lints/src/mem_discriminant.rs b/clippy_lints/src/mem_discriminant.rs index a75959e58faf..a40b1eab2c72 100644 --- a/clippy_lints/src/mem_discriminant.rs +++ b/clippy_lints/src/mem_discriminant.rs @@ -31,6 +31,10 @@ impl LintPass for MemDiscriminant { fn get_lints(&self) -> LintArray { lint_array![MEM_DISCRIMINANT_NON_ENUM] } + + fn name(&self) -> &'static str { + "MemDiscriminant" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MemDiscriminant { diff --git a/clippy_lints/src/mem_forget.rs b/clippy_lints/src/mem_forget.rs index f83a8b5f7fe8..0f25070318e0 100644 --- a/clippy_lints/src/mem_forget.rs +++ b/clippy_lints/src/mem_forget.rs @@ -27,6 +27,10 @@ impl LintPass for MemForget { fn get_lints(&self) -> LintArray { lint_array![MEM_FORGET] } + + fn name(&self) -> &'static str { + "MemForget" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MemForget { diff --git a/clippy_lints/src/mem_replace.rs b/clippy_lints/src/mem_replace.rs index d649895e33f7..1b43794bcb77 100644 --- a/clippy_lints/src/mem_replace.rs +++ b/clippy_lints/src/mem_replace.rs @@ -36,6 +36,10 @@ impl LintPass for MemReplace { fn get_lints(&self) -> LintArray { lint_array![MEM_REPLACE_OPTION_WITH_NONE] } + + fn name(&self) -> &'static str { + "MemReplace" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MemReplace { diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs index 4126b78e676b..16c3e1fb631e 100644 --- a/clippy_lints/src/methods/mod.rs +++ b/clippy_lints/src/methods/mod.rs @@ -814,6 +814,10 @@ impl LintPass for Pass { INTO_ITER_ON_REF, ) } + + fn name(&self) -> &'static str { + "Methods" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/minmax.rs b/clippy_lints/src/minmax.rs index beea667dd43c..19bede8a2806 100644 --- a/clippy_lints/src/minmax.rs +++ b/clippy_lints/src/minmax.rs @@ -31,6 +31,10 @@ impl LintPass for MinMaxPass { fn get_lints(&self) -> LintArray { lint_array!(MIN_MAX) } + + fn name(&self) -> &'static str { + "MinMax" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MinMaxPass { diff --git a/clippy_lints/src/misc.rs b/clippy_lints/src/misc.rs index 88a6d62ee6df..01f5a6333871 100644 --- a/clippy_lints/src/misc.rs +++ b/clippy_lints/src/misc.rs @@ -242,6 +242,10 @@ impl LintPass for Pass { FLOAT_CMP_CONST ) } + + fn name(&self) -> &'static str { + "MiscLints" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/misc_early.rs b/clippy_lints/src/misc_early.rs index 2cda1accc569..eb35da05908e 100644 --- a/clippy_lints/src/misc_early.rs +++ b/clippy_lints/src/misc_early.rs @@ -187,6 +187,10 @@ impl LintPass for MiscEarly { BUILTIN_TYPE_SHADOW ) } + + fn name(&self) -> &'static str { + "MiscEarlyLints" + } } // Used to find `return` statements or equivalents e.g. `?` diff --git a/clippy_lints/src/missing_doc.rs b/clippy_lints/src/missing_doc.rs index 22084bd12cbe..9fd67e2fcbfd 100644 --- a/clippy_lints/src/missing_doc.rs +++ b/clippy_lints/src/missing_doc.rs @@ -90,6 +90,10 @@ impl LintPass for MissingDoc { fn get_lints(&self) -> LintArray { lint_array![MISSING_DOCS_IN_PRIVATE_ITEMS] } + + fn name(&self) -> &'static str { + "MissingDoc" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingDoc { diff --git a/clippy_lints/src/missing_inline.rs b/clippy_lints/src/missing_inline.rs index e9d0d2d77f18..754215799e58 100644 --- a/clippy_lints/src/missing_inline.rs +++ b/clippy_lints/src/missing_inline.rs @@ -83,6 +83,10 @@ impl LintPass for MissingInline { fn get_lints(&self) -> LintArray { lint_array![MISSING_INLINE_IN_PUBLIC_ITEMS] } + + fn name(&self) -> &'static str { + "MissingInline" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MissingInline { diff --git a/clippy_lints/src/multiple_crate_versions.rs b/clippy_lints/src/multiple_crate_versions.rs index 6a042fa8c0a0..f772fa2b21c8 100644 --- a/clippy_lints/src/multiple_crate_versions.rs +++ b/clippy_lints/src/multiple_crate_versions.rs @@ -37,6 +37,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(MULTIPLE_CRATE_VERSIONS) } + + fn name(&self) -> &'static str { + "MultipleCrateVersions" + } } impl EarlyLintPass for Pass { diff --git a/clippy_lints/src/mut_mut.rs b/clippy_lints/src/mut_mut.rs index 9aa3cce9d4b2..b244c7f30315 100644 --- a/clippy_lints/src/mut_mut.rs +++ b/clippy_lints/src/mut_mut.rs @@ -30,6 +30,10 @@ impl LintPass for MutMut { fn get_lints(&self) -> LintArray { lint_array!(MUT_MUT) } + + fn name(&self) -> &'static str { + "MutMut" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MutMut { diff --git a/clippy_lints/src/mut_reference.rs b/clippy_lints/src/mut_reference.rs index 5293c80ca2b5..716abbe31fef 100644 --- a/clippy_lints/src/mut_reference.rs +++ b/clippy_lints/src/mut_reference.rs @@ -30,6 +30,10 @@ impl LintPass for UnnecessaryMutPassed { fn get_lints(&self) -> LintArray { lint_array!(UNNECESSARY_MUT_PASSED) } + + fn name(&self) -> &'static str { + "UnneccessaryMutPassed" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnnecessaryMutPassed { diff --git a/clippy_lints/src/mutex_atomic.rs b/clippy_lints/src/mutex_atomic.rs index b85f4b8ad300..fa0e8288b307 100644 --- a/clippy_lints/src/mutex_atomic.rs +++ b/clippy_lints/src/mutex_atomic.rs @@ -53,6 +53,10 @@ impl LintPass for MutexAtomic { fn get_lints(&self) -> LintArray { lint_array!(MUTEX_ATOMIC, MUTEX_INTEGER) } + + fn name(&self) -> &'static str { + "Mutex" + } } pub struct MutexAtomic; diff --git a/clippy_lints/src/needless_bool.rs b/clippy_lints/src/needless_bool.rs index 3b1fea465f51..49f607f525dc 100644 --- a/clippy_lints/src/needless_bool.rs +++ b/clippy_lints/src/needless_bool.rs @@ -61,6 +61,10 @@ impl LintPass for NeedlessBool { fn get_lints(&self) -> LintArray { lint_array!(NEEDLESS_BOOL) } + + fn name(&self) -> &'static str { + "NeedlessBool" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBool { @@ -141,6 +145,10 @@ impl LintPass for BoolComparison { fn get_lints(&self) -> LintArray { lint_array!(BOOL_COMPARISON) } + + fn name(&self) -> &'static str { + "BoolComparison" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BoolComparison { diff --git a/clippy_lints/src/needless_borrow.rs b/clippy_lints/src/needless_borrow.rs index f21cbe8b9adb..a35f31a98033 100644 --- a/clippy_lints/src/needless_borrow.rs +++ b/clippy_lints/src/needless_borrow.rs @@ -39,6 +39,10 @@ impl LintPass for NeedlessBorrow { fn get_lints(&self) -> LintArray { lint_array!(NEEDLESS_BORROW) } + + fn name(&self) -> &'static str { + "NeedlessBorrow" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBorrow { diff --git a/clippy_lints/src/needless_borrowed_ref.rs b/clippy_lints/src/needless_borrowed_ref.rs index 792e38e18751..6a0032f91b36 100644 --- a/clippy_lints/src/needless_borrowed_ref.rs +++ b/clippy_lints/src/needless_borrowed_ref.rs @@ -58,6 +58,10 @@ impl LintPass for NeedlessBorrowedRef { fn get_lints(&self) -> LintArray { lint_array!(NEEDLESS_BORROWED_REFERENCE) } + + fn name(&self) -> &'static str { + "NeedlessBorrowedRef" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBorrowedRef { diff --git a/clippy_lints/src/needless_continue.rs b/clippy_lints/src/needless_continue.rs index 0b5ea255d7f1..19d7ab32fea1 100644 --- a/clippy_lints/src/needless_continue.rs +++ b/clippy_lints/src/needless_continue.rs @@ -107,6 +107,10 @@ impl LintPass for NeedlessContinue { fn get_lints(&self) -> LintArray { lint_array!(NEEDLESS_CONTINUE) } + + fn name(&self) -> &'static str { + "NeedlessContinue" + } } impl EarlyLintPass for NeedlessContinue { diff --git a/clippy_lints/src/needless_pass_by_value.rs b/clippy_lints/src/needless_pass_by_value.rs index cb1fe475a1ee..88eb36534b5d 100644 --- a/clippy_lints/src/needless_pass_by_value.rs +++ b/clippy_lints/src/needless_pass_by_value.rs @@ -56,6 +56,10 @@ impl LintPass for NeedlessPassByValue { fn get_lints(&self) -> LintArray { lint_array![NEEDLESS_PASS_BY_VALUE] } + + fn name(&self) -> &'static str { + "NeedlessPassByValue" + } } macro_rules! need { diff --git a/clippy_lints/src/needless_update.rs b/clippy_lints/src/needless_update.rs index ab22e2c19b3d..1d91feddcbeb 100644 --- a/clippy_lints/src/needless_update.rs +++ b/clippy_lints/src/needless_update.rs @@ -33,6 +33,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(NEEDLESS_UPDATE) } + + fn name(&self) -> &'static str { + "NeedUpdate" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/neg_cmp_op_on_partial_ord.rs b/clippy_lints/src/neg_cmp_op_on_partial_ord.rs index 919c771ccf5a..50031dd68cf1 100644 --- a/clippy_lints/src/neg_cmp_op_on_partial_ord.rs +++ b/clippy_lints/src/neg_cmp_op_on_partial_ord.rs @@ -48,6 +48,10 @@ impl LintPass for NoNegCompOpForPartialOrd { fn get_lints(&self) -> LintArray { lint_array!(NEG_CMP_OP_ON_PARTIAL_ORD) } + + fn name(&self) -> &'static str { + "NoNegCompOpForPartialOrd" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NoNegCompOpForPartialOrd { diff --git a/clippy_lints/src/neg_multiply.rs b/clippy_lints/src/neg_multiply.rs index 846794d8b992..b207433b5abb 100644 --- a/clippy_lints/src/neg_multiply.rs +++ b/clippy_lints/src/neg_multiply.rs @@ -30,6 +30,10 @@ impl LintPass for NegMultiply { fn get_lints(&self) -> LintArray { lint_array!(NEG_MULTIPLY) } + + fn name(&self) -> &'static str { + "NegMultiply" + } } #[allow(clippy::match_same_arms)] diff --git a/clippy_lints/src/new_without_default.rs b/clippy_lints/src/new_without_default.rs index 37e0446faed4..f851ae4638e6 100644 --- a/clippy_lints/src/new_without_default.rs +++ b/clippy_lints/src/new_without_default.rs @@ -93,6 +93,10 @@ impl LintPass for NewWithoutDefault { fn get_lints(&self) -> LintArray { lint_array!(NEW_WITHOUT_DEFAULT) } + + fn name(&self) -> &'static str { + "NewWithoutDefault" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NewWithoutDefault { diff --git a/clippy_lints/src/no_effect.rs b/clippy_lints/src/no_effect.rs index 648c198df080..7799e8fecf2c 100644 --- a/clippy_lints/src/no_effect.rs +++ b/clippy_lints/src/no_effect.rs @@ -100,6 +100,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(NO_EFFECT, UNNECESSARY_OPERATION) } + + fn name(&self) -> &'static str { + "NoEffect" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/non_copy_const.rs b/clippy_lints/src/non_copy_const.rs index 11295c3c0929..cbf6099dd7dd 100644 --- a/clippy_lints/src/non_copy_const.rs +++ b/clippy_lints/src/non_copy_const.rs @@ -147,6 +147,10 @@ impl LintPass for NonCopyConst { fn get_lints(&self) -> LintArray { lint_array!(DECLARE_INTERIOR_MUTABLE_CONST, BORROW_INTERIOR_MUTABLE_CONST) } + + fn name(&self) -> &'static str { + "NonCopyConst" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonCopyConst { diff --git a/clippy_lints/src/non_expressive_names.rs b/clippy_lints/src/non_expressive_names.rs index f39cae46de03..3bdf2c38d237 100644 --- a/clippy_lints/src/non_expressive_names.rs +++ b/clippy_lints/src/non_expressive_names.rs @@ -71,6 +71,10 @@ impl LintPass for NonExpressiveNames { fn get_lints(&self) -> LintArray { lint_array!(SIMILAR_NAMES, MANY_SINGLE_CHAR_NAMES, JUST_UNDERSCORES_AND_DIGITS) } + + fn name(&self) -> &'static str { + "NoneExpressiveNames" + } } struct ExistingName { diff --git a/clippy_lints/src/ok_if_let.rs b/clippy_lints/src/ok_if_let.rs index 5f15662c90cb..0789df0d76b8 100644 --- a/clippy_lints/src/ok_if_let.rs +++ b/clippy_lints/src/ok_if_let.rs @@ -41,6 +41,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(IF_LET_SOME_RESULT) } + + fn name(&self) -> &'static str { + "OkIfLet" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/open_options.rs b/clippy_lints/src/open_options.rs index fe572d86c1bd..31a6caa50d69 100644 --- a/clippy_lints/src/open_options.rs +++ b/clippy_lints/src/open_options.rs @@ -30,6 +30,10 @@ impl LintPass for NonSensical { fn get_lints(&self) -> LintArray { lint_array!(NONSENSICAL_OPEN_OPTIONS) } + + fn name(&self) -> &'static str { + "OpenOptions" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NonSensical { diff --git a/clippy_lints/src/overflow_check_conditional.rs b/clippy_lints/src/overflow_check_conditional.rs index d76a9f96eff8..d424e8bcaad7 100644 --- a/clippy_lints/src/overflow_check_conditional.rs +++ b/clippy_lints/src/overflow_check_conditional.rs @@ -28,6 +28,10 @@ impl LintPass for OverflowCheckConditional { fn get_lints(&self) -> LintArray { lint_array!(OVERFLOW_CHECK_CONDITIONAL) } + + fn name(&self) -> &'static str { + "OverflowCheckConditional" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for OverflowCheckConditional { diff --git a/clippy_lints/src/panic_unimplemented.rs b/clippy_lints/src/panic_unimplemented.rs index f5c3a26e080b..d0f7487c24a2 100644 --- a/clippy_lints/src/panic_unimplemented.rs +++ b/clippy_lints/src/panic_unimplemented.rs @@ -48,6 +48,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(PANIC_PARAMS, UNIMPLEMENTED) } + + fn name(&self) -> &'static str { + "PanicUnimplemented" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/partialeq_ne_impl.rs b/clippy_lints/src/partialeq_ne_impl.rs index 03d2d5d3bab8..b9d5102ccd6a 100644 --- a/clippy_lints/src/partialeq_ne_impl.rs +++ b/clippy_lints/src/partialeq_ne_impl.rs @@ -35,6 +35,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(PARTIALEQ_NE_IMPL) } + + fn name(&self) -> &'static str { + "PartialEqNeImpl" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/precedence.rs b/clippy_lints/src/precedence.rs index 44e82984c547..ed03a8c6aa76 100644 --- a/clippy_lints/src/precedence.rs +++ b/clippy_lints/src/precedence.rs @@ -35,6 +35,10 @@ impl LintPass for Precedence { fn get_lints(&self) -> LintArray { lint_array!(PRECEDENCE) } + + fn name(&self) -> &'static str { + "Precedence" + } } impl EarlyLintPass for Precedence { diff --git a/clippy_lints/src/ptr.rs b/clippy_lints/src/ptr.rs index 87cd98928931..6b2528248b54 100644 --- a/clippy_lints/src/ptr.rs +++ b/clippy_lints/src/ptr.rs @@ -102,6 +102,10 @@ impl LintPass for PointerPass { fn get_lints(&self) -> LintArray { lint_array!(PTR_ARG, CMP_NULL, MUT_FROM_REF) } + + fn name(&self) -> &'static str { + "Ptr" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for PointerPass { diff --git a/clippy_lints/src/ptr_offset_with_cast.rs b/clippy_lints/src/ptr_offset_with_cast.rs index 32d330ac1715..4ff3f7643ba4 100644 --- a/clippy_lints/src/ptr_offset_with_cast.rs +++ b/clippy_lints/src/ptr_offset_with_cast.rs @@ -46,6 +46,10 @@ impl lint::LintPass for Pass { fn get_lints(&self) -> lint::LintArray { lint_array!(PTR_OFFSET_WITH_CAST) } + + fn name(&self) -> &'static str { + "PtrOffsetWithCast" + } } impl<'a, 'tcx> lint::LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/question_mark.rs b/clippy_lints/src/question_mark.rs index 03f6ea12e001..b30cbe4ce9a5 100644 --- a/clippy_lints/src/question_mark.rs +++ b/clippy_lints/src/question_mark.rs @@ -41,6 +41,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(QUESTION_MARK) } + + fn name(&self) -> &'static str { + "QuestionMark" + } } impl Pass { diff --git a/clippy_lints/src/ranges.rs b/clippy_lints/src/ranges.rs index 2e01afc22586..ef600184ebe2 100644 --- a/clippy_lints/src/ranges.rs +++ b/clippy_lints/src/ranges.rs @@ -97,6 +97,10 @@ impl LintPass for Pass { RANGE_MINUS_ONE ) } + + fn name(&self) -> &'static str { + "Ranges" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/redundant_clone.rs b/clippy_lints/src/redundant_clone.rs index f584ef19d5a8..59d1a4297a5c 100644 --- a/clippy_lints/src/redundant_clone.rs +++ b/clippy_lints/src/redundant_clone.rs @@ -73,6 +73,10 @@ impl LintPass for RedundantClone { fn get_lints(&self) -> LintArray { lint_array!(REDUNDANT_CLONE) } + + fn name(&self) -> &'static str { + "RedundantClone" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone { diff --git a/clippy_lints/src/redundant_field_names.rs b/clippy_lints/src/redundant_field_names.rs index 9076d67cb14a..aeb7bb6493c6 100644 --- a/clippy_lints/src/redundant_field_names.rs +++ b/clippy_lints/src/redundant_field_names.rs @@ -38,6 +38,10 @@ impl LintPass for RedundantFieldNames { fn get_lints(&self) -> LintArray { lint_array!(REDUNDANT_FIELD_NAMES) } + + fn name(&self) -> &'static str { + "RedundantFieldNames" + } } impl EarlyLintPass for RedundantFieldNames { diff --git a/clippy_lints/src/redundant_pattern_matching.rs b/clippy_lints/src/redundant_pattern_matching.rs index bc61ee8e7e32..1cf0838415f4 100644 --- a/clippy_lints/src/redundant_pattern_matching.rs +++ b/clippy_lints/src/redundant_pattern_matching.rs @@ -49,6 +49,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(REDUNDANT_PATTERN_MATCHING) } + + fn name(&self) -> &'static str { + "RedundantPatternMatching" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/reference.rs b/clippy_lints/src/reference.rs index 8d2543ef6184..3a5af498017d 100644 --- a/clippy_lints/src/reference.rs +++ b/clippy_lints/src/reference.rs @@ -30,6 +30,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(DEREF_ADDROF) } + + fn name(&self) -> &'static str { + "DerefAddrOf" + } } fn without_parens(mut e: &Expr) -> &Expr { @@ -84,6 +88,10 @@ impl LintPass for DerefPass { fn get_lints(&self) -> LintArray { lint_array!(REF_IN_DEREF) } + + fn name(&self) -> &'static str { + "RefInDeref" + } } impl EarlyLintPass for DerefPass { diff --git a/clippy_lints/src/regex.rs b/clippy_lints/src/regex.rs index 6a58a6e73c71..0171c2a52831 100644 --- a/clippy_lints/src/regex.rs +++ b/clippy_lints/src/regex.rs @@ -76,6 +76,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(INVALID_REGEX, REGEX_MACRO, TRIVIAL_REGEX) } + + fn name(&self) -> &'static str { + "Regex" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/replace_consts.rs b/clippy_lints/src/replace_consts.rs index ea51e4711cdb..16c8cc3bc47a 100644 --- a/clippy_lints/src/replace_consts.rs +++ b/clippy_lints/src/replace_consts.rs @@ -35,6 +35,10 @@ impl LintPass for ReplaceConsts { fn get_lints(&self) -> LintArray { lint_array!(REPLACE_CONSTS) } + + fn name(&self) -> &'static str { + "ReplaceConsts" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ReplaceConsts { diff --git a/clippy_lints/src/returns.rs b/clippy_lints/src/returns.rs index d81d04b81d37..83b4d7f91120 100644 --- a/clippy_lints/src/returns.rs +++ b/clippy_lints/src/returns.rs @@ -180,6 +180,10 @@ impl LintPass for ReturnPass { fn get_lints(&self) -> LintArray { lint_array!(NEEDLESS_RETURN, LET_AND_RETURN, UNUSED_UNIT) } + + fn name(&self) -> &'static str { + "Return" + } } impl EarlyLintPass for ReturnPass { diff --git a/clippy_lints/src/serde_api.rs b/clippy_lints/src/serde_api.rs index da8675b38dac..8090ed7fbcff 100644 --- a/clippy_lints/src/serde_api.rs +++ b/clippy_lints/src/serde_api.rs @@ -25,6 +25,10 @@ impl LintPass for Serde { fn get_lints(&self) -> LintArray { lint_array!(SERDE_API_MISUSE) } + + fn name(&self) -> &'static str { + "SerdeAPI" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Serde { diff --git a/clippy_lints/src/shadow.rs b/clippy_lints/src/shadow.rs index c99b00bb98f9..1f341bd22ee8 100644 --- a/clippy_lints/src/shadow.rs +++ b/clippy_lints/src/shadow.rs @@ -82,6 +82,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(SHADOW_SAME, SHADOW_REUSE, SHADOW_UNRELATED) } + + fn name(&self) -> &'static str { + "Shadow" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/slow_vector_initialization.rs b/clippy_lints/src/slow_vector_initialization.rs index aea414065d85..0765e4e11bed 100644 --- a/clippy_lints/src/slow_vector_initialization.rs +++ b/clippy_lints/src/slow_vector_initialization.rs @@ -37,6 +37,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(SLOW_VECTOR_INITIALIZATION,) } + + fn name(&self) -> &'static str { + "SlowVectorInit" + } } /// `VecAllocation` contains data regarding a vector allocated with `with_capacity` and then diff --git a/clippy_lints/src/strings.rs b/clippy_lints/src/strings.rs index ffec764fd5e8..71784397463b 100644 --- a/clippy_lints/src/strings.rs +++ b/clippy_lints/src/strings.rs @@ -79,6 +79,10 @@ impl LintPass for StringAdd { fn get_lints(&self) -> LintArray { lint_array!(STRING_ADD, STRING_ADD_ASSIGN) } + + fn name(&self) -> &'static str { + "StringAdd" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for StringAdd { @@ -151,6 +155,10 @@ impl LintPass for StringLitAsBytes { fn get_lints(&self) -> LintArray { lint_array!(STRING_LIT_AS_BYTES) } + + fn name(&self) -> &'static str { + "StringLiteralAsBytes" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for StringLitAsBytes { diff --git a/clippy_lints/src/suspicious_trait_impl.rs b/clippy_lints/src/suspicious_trait_impl.rs index c6dd9504857a..5f0e49dd7e6d 100644 --- a/clippy_lints/src/suspicious_trait_impl.rs +++ b/clippy_lints/src/suspicious_trait_impl.rs @@ -57,6 +57,10 @@ impl LintPass for SuspiciousImpl { fn get_lints(&self) -> LintArray { lint_array![SUSPICIOUS_ARITHMETIC_IMPL, SUSPICIOUS_OP_ASSIGN_IMPL] } + + fn name(&self) -> &'static str { + "SuspiciousImpl" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for SuspiciousImpl { diff --git a/clippy_lints/src/swap.rs b/clippy_lints/src/swap.rs index ddf33fcc411f..860707c82395 100644 --- a/clippy_lints/src/swap.rs +++ b/clippy_lints/src/swap.rs @@ -57,6 +57,10 @@ impl LintPass for Swap { fn get_lints(&self) -> LintArray { lint_array![MANUAL_SWAP, ALMOST_SWAPPED] } + + fn name(&self) -> &'static str { + "Swap" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Swap { diff --git a/clippy_lints/src/temporary_assignment.rs b/clippy_lints/src/temporary_assignment.rs index c8a01c3668c6..0d8cfedf4144 100644 --- a/clippy_lints/src/temporary_assignment.rs +++ b/clippy_lints/src/temporary_assignment.rs @@ -44,6 +44,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(TEMPORARY_ASSIGNMENT) } + + fn name(&self) -> &'static str { + "TemporaryAssignment" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/transmute.rs b/clippy_lints/src/transmute.rs index 02205cfbd683..88371df0dca5 100644 --- a/clippy_lints/src/transmute.rs +++ b/clippy_lints/src/transmute.rs @@ -219,6 +219,10 @@ impl LintPass for Transmute { TRANSMUTE_INT_TO_FLOAT, ) } + + fn name(&self) -> &'static str { + "Transmute" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Transmute { diff --git a/clippy_lints/src/trivially_copy_pass_by_ref.rs b/clippy_lints/src/trivially_copy_pass_by_ref.rs index 5ab73758301f..4e3bb7d329e1 100644 --- a/clippy_lints/src/trivially_copy_pass_by_ref.rs +++ b/clippy_lints/src/trivially_copy_pass_by_ref.rs @@ -142,6 +142,10 @@ impl LintPass for TriviallyCopyPassByRef { fn get_lints(&self) -> LintArray { lint_array![TRIVIALLY_COPY_PASS_BY_REF] } + + fn name(&self) -> &'static str { + "TrivallyCopyPassByRef" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TriviallyCopyPassByRef { diff --git a/clippy_lints/src/types.rs b/clippy_lints/src/types.rs index 898fd5a98089..4683ffb4c85b 100644 --- a/clippy_lints/src/types.rs +++ b/clippy_lints/src/types.rs @@ -168,6 +168,10 @@ impl LintPass for TypePass { fn get_lints(&self) -> LintArray { lint_array!(BOX_VEC, VEC_BOX, OPTION_OPTION, LINKEDLIST, BORROWED_BOX) } + + fn name(&self) -> &'static str { + "Types" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypePass { @@ -467,6 +471,10 @@ impl LintPass for LetPass { fn get_lints(&self) -> LintArray { lint_array!(LET_UNIT_VALUE) } + + fn name(&self) -> &'static str { + "LetUnitValue" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LetPass { @@ -531,6 +539,10 @@ impl LintPass for UnitCmp { fn get_lints(&self) -> LintArray { lint_array!(UNIT_CMP) } + + fn name(&self) -> &'static str { + "UnicCmp" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnitCmp { @@ -586,6 +598,10 @@ impl LintPass for UnitArg { fn get_lints(&self) -> LintArray { lint_array!(UNIT_ARG) } + + fn name(&self) -> &'static str { + "UnitArg" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnitArg { @@ -1073,6 +1089,10 @@ impl LintPass for CastPass { FN_TO_NUMERIC_CAST_WITH_TRUNCATION, ) } + + fn name(&self) -> &'static str { + "Casts" + } } // Check if the given type is either `core::ffi::c_void` or @@ -1278,6 +1298,10 @@ impl LintPass for TypeComplexityPass { fn get_lints(&self) -> LintArray { lint_array!(TYPE_COMPLEXITY) } + + fn name(&self) -> &'static str { + "TypeComplexityPass" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for TypeComplexityPass { @@ -1442,6 +1466,10 @@ impl LintPass for CharLitAsU8 { fn get_lints(&self) -> LintArray { lint_array!(CHAR_LIT_AS_U8) } + + fn name(&self) -> &'static str { + "CharLiteralAsU8" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CharLitAsU8 { @@ -1500,6 +1528,10 @@ impl LintPass for AbsurdExtremeComparisons { fn get_lints(&self) -> LintArray { lint_array!(ABSURD_EXTREME_COMPARISONS) } + + fn name(&self) -> &'static str { + "AbsurdExtremeComparisons" + } } enum ExtremeType { @@ -1675,6 +1707,10 @@ impl LintPass for InvalidUpcastComparisons { fn get_lints(&self) -> LintArray { lint_array!(INVALID_UPCAST_COMPARISONS) } + + fn name(&self) -> &'static str { + "InvalidUpcastComparisons" + } } #[derive(Copy, Clone, Debug, Eq)] @@ -1918,6 +1954,10 @@ impl LintPass for ImplicitHasher { fn get_lints(&self) -> LintArray { lint_array!(IMPLICIT_HASHER) } + + fn name(&self) -> &'static str { + "ImplicitHasher" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ImplicitHasher { @@ -2265,6 +2305,10 @@ impl LintPass for RefToMut { fn get_lints(&self) -> LintArray { lint_array!(CAST_REF_TO_MUT) } + + fn name(&self) -> &'static str { + "RefToMut" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RefToMut { diff --git a/clippy_lints/src/unicode.rs b/clippy_lints/src/unicode.rs index d9207fd2131d..d1f39a5e2c23 100644 --- a/clippy_lints/src/unicode.rs +++ b/clippy_lints/src/unicode.rs @@ -65,6 +65,10 @@ impl LintPass for Unicode { fn get_lints(&self) -> LintArray { lint_array!(ZERO_WIDTH_SPACE, NON_ASCII_LITERAL, UNICODE_NOT_NFC) } + + fn name(&self) -> &'static str { + "Unicode" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Unicode { diff --git a/clippy_lints/src/unsafe_removed_from_name.rs b/clippy_lints/src/unsafe_removed_from_name.rs index 6beda8ce706a..6cf1a582a654 100644 --- a/clippy_lints/src/unsafe_removed_from_name.rs +++ b/clippy_lints/src/unsafe_removed_from_name.rs @@ -32,6 +32,10 @@ impl LintPass for UnsafeNameRemoval { fn get_lints(&self) -> LintArray { lint_array!(UNSAFE_REMOVED_FROM_NAME) } + + fn name(&self) -> &'static str { + "UnsafeNameRemoval" + } } impl EarlyLintPass for UnsafeNameRemoval { diff --git a/clippy_lints/src/unused_io_amount.rs b/clippy_lints/src/unused_io_amount.rs index 27deb0d99459..d54cd3bba030 100644 --- a/clippy_lints/src/unused_io_amount.rs +++ b/clippy_lints/src/unused_io_amount.rs @@ -36,6 +36,10 @@ impl LintPass for UnusedIoAmount { fn get_lints(&self) -> LintArray { lint_array!(UNUSED_IO_AMOUNT) } + + fn name(&self) -> &'static str { + "UnusedIoAmount" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedIoAmount { diff --git a/clippy_lints/src/unused_label.rs b/clippy_lints/src/unused_label.rs index d53fd265d373..29d76a051186 100644 --- a/clippy_lints/src/unused_label.rs +++ b/clippy_lints/src/unused_label.rs @@ -39,6 +39,10 @@ impl LintPass for UnusedLabel { fn get_lints(&self) -> LintArray { lint_array!(UNUSED_LABEL) } + + fn name(&self) -> &'static str { + "UnusedLable" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedLabel { diff --git a/clippy_lints/src/unwrap.rs b/clippy_lints/src/unwrap.rs index 369b33363b5a..196715f77d77 100644 --- a/clippy_lints/src/unwrap.rs +++ b/clippy_lints/src/unwrap.rs @@ -184,6 +184,10 @@ impl<'a> LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(PANICKING_UNWRAP, UNNECESSARY_UNWRAP) } + + fn name(&self) -> &'static str { + "Unwrap" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/use_self.rs b/clippy_lints/src/use_self.rs index 88cf01987b55..1f1d9ddbfec4 100644 --- a/clippy_lints/src/use_self.rs +++ b/clippy_lints/src/use_self.rs @@ -51,6 +51,10 @@ impl LintPass for UseSelf { fn get_lints(&self) -> LintArray { lint_array!(USE_SELF) } + + fn name(&self) -> &'static str { + "UseSelf" + } } const SEGMENTS_MSG: &str = "segments should be composed of at least 1 element"; diff --git a/clippy_lints/src/utils/author.rs b/clippy_lints/src/utils/author.rs index 9623c6cbdadd..19c3f3ad2302 100644 --- a/clippy_lints/src/utils/author.rs +++ b/clippy_lints/src/utils/author.rs @@ -53,6 +53,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(LINT_AUTHOR) } + + fn name(&self) -> &'static str { + "Author" + } } fn prelude() { diff --git a/clippy_lints/src/utils/inspector.rs b/clippy_lints/src/utils/inspector.rs index 4116f8ffbafa..758d1d2d3651 100644 --- a/clippy_lints/src/utils/inspector.rs +++ b/clippy_lints/src/utils/inspector.rs @@ -35,6 +35,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(DEEP_CODE_INSPECTION) } + + fn name(&self) -> &'static str { + "DeepCodeInspector" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/utils/internal_lints.rs b/clippy_lints/src/utils/internal_lints.rs index 788fc434d510..78950493699a 100644 --- a/clippy_lints/src/utils/internal_lints.rs +++ b/clippy_lints/src/utils/internal_lints.rs @@ -98,6 +98,10 @@ impl LintPass for Clippy { fn get_lints(&self) -> LintArray { lint_array!(CLIPPY_LINTS_INTERNAL) } + + fn name(&self) -> &'static str { + "ClippyLintsInternal" + } } impl EarlyLintPass for Clippy { @@ -139,6 +143,9 @@ impl LintPass for LintWithoutLintPass { fn get_lints(&self) -> LintArray { lint_array!(LINT_WITHOUT_LINT_PASS) } + fn name(&self) -> &'static str { + "LintWithoutLintPass" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LintWithoutLintPass { @@ -248,6 +255,10 @@ impl LintPass for DefaultHashTypes { fn get_lints(&self) -> LintArray { lint_array!(DEFAULT_HASH_TYPES) } + + fn name(&self) -> &'static str { + "DefaultHashType" + } } impl EarlyLintPass for DefaultHashTypes { @@ -293,6 +304,10 @@ impl LintPass for CompilerLintFunctions { fn get_lints(&self) -> LintArray { lint_array!(COMPILER_LINT_FUNCTIONS) } + + fn name(&self) -> &'static str { + "CompileLintFunctions" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CompilerLintFunctions { diff --git a/clippy_lints/src/vec.rs b/clippy_lints/src/vec.rs index 407722bc66e2..a99b6ca840c0 100644 --- a/clippy_lints/src/vec.rs +++ b/clippy_lints/src/vec.rs @@ -32,6 +32,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(USELESS_VEC) } + + fn name(&self) -> &'static str { + "UselessVec" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/clippy_lints/src/wildcard_dependencies.rs b/clippy_lints/src/wildcard_dependencies.rs index fb88b1371f7e..8ccf2c69cc7f 100644 --- a/clippy_lints/src/wildcard_dependencies.rs +++ b/clippy_lints/src/wildcard_dependencies.rs @@ -33,6 +33,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(WILDCARD_DEPENDENCIES) } + + fn name(&self) -> &'static str { + "WildcardDependencies" + } } impl EarlyLintPass for Pass { diff --git a/clippy_lints/src/write.rs b/clippy_lints/src/write.rs index c8c291c8cc87..36f7fee969b9 100644 --- a/clippy_lints/src/write.rs +++ b/clippy_lints/src/write.rs @@ -175,6 +175,10 @@ impl LintPass for Pass { WRITE_LITERAL ) } + + fn name(&self) -> &'static str { + "Write" + } } impl EarlyLintPass for Pass { diff --git a/clippy_lints/src/zero_div_zero.rs b/clippy_lints/src/zero_div_zero.rs index 962d42e631ea..a806be954322 100644 --- a/clippy_lints/src/zero_div_zero.rs +++ b/clippy_lints/src/zero_div_zero.rs @@ -28,6 +28,10 @@ impl LintPass for Pass { fn get_lints(&self) -> LintArray { lint_array!(ZERO_DIVIDED_BY_ZERO) } + + fn name(&self) -> &'static str { + "ZeroDiv" + } } impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { diff --git a/src/driver.rs b/src/driver.rs index 2faa77785bb5..1ce6f6b7c496 100644 --- a/src/driver.rs +++ b/src/driver.rs @@ -123,7 +123,7 @@ pub fn main() { let sess = &state.session; let mut ls = sess.lint_store.borrow_mut(); for pass in early_lint_passes { - ls.register_early_pass(Some(sess), true, pass); + ls.register_early_pass(Some(sess), true, false, pass); } for pass in late_lint_passes { ls.register_late_pass(Some(sess), true, pass); diff --git a/tests/ui/lint_without_lint_pass.rs b/tests/ui/lint_without_lint_pass.rs index 1f2fcd8faf61..a6f10a006dbd 100644 --- a/tests/ui/lint_without_lint_pass.rs +++ b/tests/ui/lint_without_lint_pass.rs @@ -25,6 +25,10 @@ impl lint::LintPass for Pass { fn get_lints(&self) -> lint::LintArray { lint_array!(TEST_LINT_REGISTERED) } + + fn name(&self) -> &'static str { + "TEST_LINT" + } } fn main() {} From 3a96d6b603b0a55fa14bb91d23c080725a257c04 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 27 Jan 2019 13:33:56 +0100 Subject: [PATCH 2/4] rustup https://github.com/rust-lang/rust/pull/57907/ for file in `fd \.rs$` ; do sed -i s/span_suggestion_with_applicability/span_suggestion/g $file ; done for file in `fd \.rs$` ; do sed -i s/span_suggestion_short_with_applicability/span_suggestion_short/g $file ; done for file in `fd \.rs$` ; do sed -i s/span_suggestions_with_applicability/span_suggestions/g $file ; done --- clippy_lints/src/assign_ops.rs | 6 +++--- clippy_lints/src/attrs.rs | 4 ++-- clippy_lints/src/bit_mask.rs | 2 +- clippy_lints/src/booleans.rs | 4 ++-- clippy_lints/src/collapsible_if.rs | 2 +- clippy_lints/src/const_static_lifetime.rs | 2 +- clippy_lints/src/copies.rs | 2 +- clippy_lints/src/entry.rs | 4 ++-- clippy_lints/src/eq_op.rs | 8 ++++---- clippy_lints/src/eta_reduction.rs | 2 +- clippy_lints/src/format.rs | 4 ++-- clippy_lints/src/identity_conversion.rs | 6 +++--- clippy_lints/src/implicit_return.rs | 2 +- clippy_lints/src/int_plus_one.rs | 2 +- clippy_lints/src/large_enum_variant.rs | 2 +- clippy_lints/src/let_if_seq.rs | 2 +- clippy_lints/src/loops.rs | 8 ++++---- clippy_lints/src/map_unit_fn.rs | 6 +++--- clippy_lints/src/matches.rs | 2 +- clippy_lints/src/mem_discriminant.rs | 2 +- clippy_lints/src/methods/mod.rs | 10 +++++----- clippy_lints/src/misc.rs | 8 ++++---- clippy_lints/src/misc_early.rs | 6 +++--- clippy_lints/src/needless_borrow.rs | 4 ++-- clippy_lints/src/needless_borrowed_ref.rs | 2 +- clippy_lints/src/needless_pass_by_value.rs | 8 ++++---- clippy_lints/src/non_copy_const.rs | 2 +- clippy_lints/src/ptr.rs | 10 +++++----- clippy_lints/src/question_mark.rs | 2 +- clippy_lints/src/ranges.rs | 6 +++--- clippy_lints/src/redundant_clone.rs | 2 +- clippy_lints/src/redundant_pattern_matching.rs | 4 ++-- clippy_lints/src/returns.rs | 8 ++++---- clippy_lints/src/slow_vector_initialization.rs | 2 +- clippy_lints/src/swap.rs | 4 ++-- clippy_lints/src/transmute.rs | 18 +++++++++--------- clippy_lints/src/utils/mod.rs | 2 +- clippy_lints/src/utils/sugg.rs | 6 +++--- 38 files changed, 88 insertions(+), 88 deletions(-) diff --git a/clippy_lints/src/assign_ops.rs b/clippy_lints/src/assign_ops.rs index 329bab5cf1ca..cc44b514ea77 100644 --- a/clippy_lints/src/assign_ops.rs +++ b/clippy_lints/src/assign_ops.rs @@ -83,7 +83,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps { let r = &sugg::Sugg::hir(cx, rhs, ".."); let long = format!("{} = {}", snip_a, sugg::make_binop(higher::binop(op.node), a, r)); - db.span_suggestion_with_applicability( + db.span_suggestion( expr.span, &format!( "Did you mean {} = {} {} {} or {}? Consider replacing it with", @@ -96,7 +96,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps { format!("{} {}= {}", snip_a, op.node.as_str(), snip_r), Applicability::MachineApplicable, ); - db.span_suggestion_with_applicability( + db.span_suggestion( expr.span, "or", long, @@ -183,7 +183,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssignOps { if let (Some(snip_a), Some(snip_r)) = (snippet_opt(cx, assignee.span), snippet_opt(cx, rhs.span)) { - db.span_suggestion_with_applicability( + db.span_suggestion( expr.span, "replace it with", format!("{} {}= {}", snip_a, op.node.as_str(), snip_r), diff --git a/clippy_lints/src/attrs.rs b/clippy_lints/src/attrs.rs index 4a5eb378d5a1..89dbba56130a 100644 --- a/clippy_lints/src/attrs.rs +++ b/clippy_lints/src/attrs.rs @@ -273,7 +273,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AttrPass { "useless lint attribute", |db| { sugg = sugg.replacen("#[", "#![", 1); - db.span_suggestion_with_applicability( + db.span_suggestion( line_span, "if you just forgot a `!`, use", sugg, @@ -336,7 +336,7 @@ fn check_clippy_lint_names(cx: &LateContext<'_, '_>, items: &[NestedMetaItem]) { // https://github.com/rust-lang/rust/pull/56992 CheckLintNameResult::NoLint(None) => (), _ => { - db.span_suggestion_with_applicability( + db.span_suggestion( lint.span, "lowercase the lint name", name_lower, diff --git a/clippy_lints/src/bit_mask.rs b/clippy_lints/src/bit_mask.rs index ef0943875d20..d4e303761990 100644 --- a/clippy_lints/src/bit_mask.rs +++ b/clippy_lints/src/bit_mask.rs @@ -142,7 +142,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BitMask { "bit mask could be simplified with a call to `trailing_zeros`", |db| { let sugg = Sugg::hir(cx, left1, "...").maybe_par(); - db.span_suggestion_with_applicability( + db.span_suggestion( e.span, "try", format!("{}.trailing_zeros() >= {}", sugg, n.count_ones()), diff --git a/clippy_lints/src/booleans.rs b/clippy_lints/src/booleans.rs index 6b53dd908de9..6433e0d640d5 100644 --- a/clippy_lints/src/booleans.rs +++ b/clippy_lints/src/booleans.rs @@ -393,7 +393,7 @@ impl<'a, 'tcx> NonminimalBoolVisitor<'a, 'tcx> { "this expression can be optimized out by applying boolean operations to the \ outer expression", ); - db.span_suggestion_with_applicability( + db.span_suggestion( e.span, "it would look like the following", suggest(self.cx, suggestion, &h2q.terminals).0, @@ -423,7 +423,7 @@ impl<'a, 'tcx> NonminimalBoolVisitor<'a, 'tcx> { e.span, "this boolean expression can be simplified", |db| { - db.span_suggestions_with_applicability( + db.span_suggestions( e.span, "try", suggestions.into_iter(), diff --git a/clippy_lints/src/collapsible_if.rs b/clippy_lints/src/collapsible_if.rs index c236706f02fb..9539b4d89f96 100644 --- a/clippy_lints/src/collapsible_if.rs +++ b/clippy_lints/src/collapsible_if.rs @@ -154,7 +154,7 @@ fn check_collapsible_no_if_let(cx: &EarlyContext<'_>, expr: &ast::Expr, check: & span_lint_and_then(cx, COLLAPSIBLE_IF, expr.span, "this if statement can be collapsed", |db| { let lhs = Sugg::ast(cx, check, ".."); let rhs = Sugg::ast(cx, check_inner, ".."); - db.span_suggestion_with_applicability( + db.span_suggestion( expr.span, "try", format!( diff --git a/clippy_lints/src/const_static_lifetime.rs b/clippy_lints/src/const_static_lifetime.rs index 7315184c8bd4..2684f45660e1 100644 --- a/clippy_lints/src/const_static_lifetime.rs +++ b/clippy_lints/src/const_static_lifetime.rs @@ -66,7 +66,7 @@ impl StaticConst { lifetime.ident.span, "Constants have by default a `'static` lifetime", |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( ty.span, "consider removing `'static`", sugg, diff --git a/clippy_lints/src/copies.rs b/clippy_lints/src/copies.rs index 6bb75cf8064e..c704a635425d 100644 --- a/clippy_lints/src/copies.rs +++ b/clippy_lints/src/copies.rs @@ -207,7 +207,7 @@ fn lint_match_arms(cx: &LateContext<'_, '_>, expr: &Expr) { |db| { db.span_note(i.body.span, "same as this"); - // Note: this does not use `span_suggestion_with_applicability` on purpose: + // Note: this does not use `span_suggestion` on purpose: // there is no clean way // to remove the other arm. Building a span and suggest to replace it to "" // makes an even more confusing error message. Also in order not to make up a diff --git a/clippy_lints/src/entry.rs b/clippy_lints/src/entry.rs index 8de881d0425b..3e0a6e11be6e 100644 --- a/clippy_lints/src/entry.rs +++ b/clippy_lints/src/entry.rs @@ -149,7 +149,7 @@ impl<'a, 'tcx, 'b> Visitor<'tcx> for InsertVisitor<'a, 'tcx, 'b> { snippet(self.cx, params[1].span, ".."), snippet(self.cx, params[2].span, "..")); - db.span_suggestion_with_applicability( + db.span_suggestion( self.span, "consider using", help, @@ -161,7 +161,7 @@ impl<'a, 'tcx, 'b> Visitor<'tcx> for InsertVisitor<'a, 'tcx, 'b> { snippet(self.cx, self.map.span, "map"), snippet(self.cx, params[1].span, "..")); - db.span_suggestion_with_applicability( + db.span_suggestion( self.span, "consider using", help, diff --git a/clippy_lints/src/eq_op.rs b/clippy_lints/src/eq_op.rs index 38c9a05b44c6..57291dd24eee 100644 --- a/clippy_lints/src/eq_op.rs +++ b/clippy_lints/src/eq_op.rs @@ -126,7 +126,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp { { span_lint_and_then(cx, OP_REF, e.span, "needlessly taken reference of left operand", |db| { let lsnip = snippet(cx, l.span, "...").to_string(); - db.span_suggestion_with_applicability( + db.span_suggestion( left.span, "use the left value directly", lsnip, @@ -144,7 +144,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp { "needlessly taken reference of right operand", |db| { let rsnip = snippet(cx, r.span, "...").to_string(); - db.span_suggestion_with_applicability( + db.span_suggestion( right.span, "use the right value directly", rsnip, @@ -163,7 +163,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp { { span_lint_and_then(cx, OP_REF, e.span, "needlessly taken reference of left operand", |db| { let lsnip = snippet(cx, l.span, "...").to_string(); - db.span_suggestion_with_applicability( + db.span_suggestion( left.span, "use the left value directly", lsnip, @@ -181,7 +181,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for EqOp { { span_lint_and_then(cx, OP_REF, e.span, "taken reference of right operand", |db| { let rsnip = snippet(cx, r.span, "...").to_string(); - db.span_suggestion_with_applicability( + db.span_suggestion( right.span, "use the right value directly", rsnip, diff --git a/clippy_lints/src/eta_reduction.rs b/clippy_lints/src/eta_reduction.rs index cc86aee7defa..f0557154f903 100644 --- a/clippy_lints/src/eta_reduction.rs +++ b/clippy_lints/src/eta_reduction.rs @@ -101,7 +101,7 @@ fn check_closure(cx: &LateContext<'_, '_>, expr: &Expr) { } span_lint_and_then(cx, REDUNDANT_CLOSURE, expr.span, "redundant closure found", |db| { if let Some(snippet) = snippet_opt(cx, caller.span) { - db.span_suggestion_with_applicability( + db.span_suggestion( expr.span, "remove closure as shown", snippet, diff --git a/clippy_lints/src/format.rs b/clippy_lints/src/format.rs index f14c281fcc98..aaef5b39aeb8 100644 --- a/clippy_lints/src/format.rs +++ b/clippy_lints/src/format.rs @@ -83,7 +83,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { }; span_lint_and_then(cx, USELESS_FORMAT, span, "useless use of `format!`", |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( expr.span, message, sugg, @@ -99,7 +99,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { if tup.is_empty() { let sugg = format!("{}.to_string()", snippet(cx, expr.span, "").into_owned()); span_lint_and_then(cx, USELESS_FORMAT, span, "useless use of `format!`", |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( span, "consider using .to_string()", sugg, diff --git a/clippy_lints/src/identity_conversion.rs b/clippy_lints/src/identity_conversion.rs index 2c0e389119fe..abe8a9d6856c 100644 --- a/clippy_lints/src/identity_conversion.rs +++ b/clippy_lints/src/identity_conversion.rs @@ -71,7 +71,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IdentityConversion { let sugg = snippet_with_macro_callsite(cx, args[0].span, "").to_string(); span_lint_and_then(cx, IDENTITY_CONVERSION, e.span, "identical conversion", |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( e.span, "consider removing `.into()`", sugg, @@ -86,7 +86,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IdentityConversion { if same_tys(cx, a, b) { let sugg = snippet(cx, args[0].span, "").into_owned(); span_lint_and_then(cx, IDENTITY_CONVERSION, e.span, "identical conversion", |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( e.span, "consider removing `.into_iter()`", sugg, @@ -108,7 +108,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IdentityConversion { let sugg_msg = format!("consider removing `{}()`", snippet(cx, path.span, "From::from")); span_lint_and_then(cx, IDENTITY_CONVERSION, e.span, "identical conversion", |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( e.span, &sugg_msg, sugg, diff --git a/clippy_lints/src/implicit_return.rs b/clippy_lints/src/implicit_return.rs index b25b3bce652b..72d95a0763ae 100644 --- a/clippy_lints/src/implicit_return.rs +++ b/clippy_lints/src/implicit_return.rs @@ -39,7 +39,7 @@ impl Pass { fn lint(cx: &LateContext<'_, '_>, outer_span: syntax_pos::Span, inner_span: syntax_pos::Span, msg: &str) { span_lint_and_then(cx, IMPLICIT_RETURN, outer_span, "missing return statement", |db| { if let Some(snippet) = snippet_opt(cx, inner_span) { - db.span_suggestion_with_applicability( + db.span_suggestion( outer_span, msg, format!("return {}", snippet), diff --git a/clippy_lints/src/int_plus_one.rs b/clippy_lints/src/int_plus_one.rs index aee3b7cc5423..9b5938baf5f2 100644 --- a/clippy_lints/src/int_plus_one.rs +++ b/clippy_lints/src/int_plus_one.rs @@ -162,7 +162,7 @@ impl IntPlusOne { block.span, "Unnecessary `>= y + 1` or `x - 1 >=`", |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( block.span, "change `>= y + 1` to `> y` as shown", recommendation, diff --git a/clippy_lints/src/large_enum_variant.rs b/clippy_lints/src/large_enum_variant.rs index 0b3cf07e50ae..59e036c715ef 100644 --- a/clippy_lints/src/large_enum_variant.rs +++ b/clippy_lints/src/large_enum_variant.rs @@ -100,7 +100,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LargeEnumVariant { VariantData::Unit(_) => unreachable!(), }; if let Some(snip) = snippet_opt(cx, span) { - db.span_suggestion_with_applicability( + db.span_suggestion( span, "consider boxing the large fields to reduce the total size of the \ enum", diff --git a/clippy_lints/src/let_if_seq.rs b/clippy_lints/src/let_if_seq.rs index 3eb25cfb36ad..f1aed79847f7 100644 --- a/clippy_lints/src/let_if_seq.rs +++ b/clippy_lints/src/let_if_seq.rs @@ -124,7 +124,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for LetIfSeq { span, "`if _ { .. } else { .. }` is an expression", |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( span, "it is more idiomatic to write", sug, diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs index 64e76c09989e..4d6cc75135ec 100644 --- a/clippy_lints/src/loops.rs +++ b/clippy_lints/src/loops.rs @@ -1304,7 +1304,7 @@ fn check_for_loop_reverse_range<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, arg: &'tcx expr.span, "this range is empty so this for loop will never run", |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( arg.span, "consider using the following if you are attempting to iterate over this \ range in reverse", @@ -2408,7 +2408,7 @@ fn check_needless_collect<'a, 'tcx>(expr: &'tcx Expr, cx: &LateContext<'a, 'tcx> if method.ident.name == "len" { let span = shorten_needless_collect_span(expr); span_lint_and_then(cx, NEEDLESS_COLLECT, span, NEEDLESS_COLLECT_MSG, |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( span, "replace with", ".count()".to_string(), @@ -2419,7 +2419,7 @@ fn check_needless_collect<'a, 'tcx>(expr: &'tcx Expr, cx: &LateContext<'a, 'tcx> if method.ident.name == "is_empty" { let span = shorten_needless_collect_span(expr); span_lint_and_then(cx, NEEDLESS_COLLECT, span, NEEDLESS_COLLECT_MSG, |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( span, "replace with", ".next().is_none()".to_string(), @@ -2431,7 +2431,7 @@ fn check_needless_collect<'a, 'tcx>(expr: &'tcx Expr, cx: &LateContext<'a, 'tcx> let contains_arg = snippet(cx, args[1].span, "??"); let span = shorten_needless_collect_span(expr); span_lint_and_then(cx, NEEDLESS_COLLECT, span, NEEDLESS_COLLECT_MSG, |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( span, "replace with", format!( diff --git a/clippy_lints/src/map_unit_fn.rs b/clippy_lints/src/map_unit_fn.rs index bd4b40438248..75e12cd9fd32 100644 --- a/clippy_lints/src/map_unit_fn.rs +++ b/clippy_lints/src/map_unit_fn.rs @@ -216,7 +216,7 @@ fn lint_map_unit_fn(cx: &LateContext<'_, '_>, stmt: &hir::Stmt, expr: &hir::Expr ); span_lint_and_then(cx, lint, expr.span, &msg, |db| { - db.span_suggestion_with_applicability(stmt.span, "try this", suggestion, Applicability::Unspecified); + db.span_suggestion(stmt.span, "try this", suggestion, Applicability::Unspecified); }); } else if let Some((binding, closure_expr)) = unit_closure(cx, fn_arg) { let msg = suggestion_msg("closure", map_type); @@ -230,7 +230,7 @@ fn lint_map_unit_fn(cx: &LateContext<'_, '_>, stmt: &hir::Stmt, expr: &hir::Expr snippet(cx, var_arg.span, "_"), snippet(cx, reduced_expr_span, "_") ); - db.span_suggestion_with_applicability( + db.span_suggestion( stmt.span, "try this", suggestion, @@ -243,7 +243,7 @@ fn lint_map_unit_fn(cx: &LateContext<'_, '_>, stmt: &hir::Stmt, expr: &hir::Expr snippet(cx, binding.pat.span, "_"), snippet(cx, var_arg.span, "_") ); - db.span_suggestion_with_applicability(stmt.span, "try this", suggestion, Applicability::Unspecified); + db.span_suggestion(stmt.span, "try this", suggestion, Applicability::Unspecified); } }); } diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index adb8dab5c427..b290980fc361 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -375,7 +375,7 @@ fn check_match_bool(cx: &LateContext<'_, '_>, ex: &Expr, arms: &[Arm], expr: &Ex }; if let Some(sugg) = sugg { - db.span_suggestion_with_applicability( + db.span_suggestion( expr.span, "consider using an if/else expression", sugg, diff --git a/clippy_lints/src/mem_discriminant.rs b/clippy_lints/src/mem_discriminant.rs index a40b1eab2c72..65e473698198 100644 --- a/clippy_lints/src/mem_discriminant.rs +++ b/clippy_lints/src/mem_discriminant.rs @@ -74,7 +74,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MemDiscriminant { } let derefs: String = iter::repeat('*').take(derefs_needed).collect(); - db.span_suggestion_with_applicability( + db.span_suggestion( param.span, "try dereferencing", format!("{}{}", derefs, snippet(cx, cur_expr.span, "")), diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs index 16c3e1fb631e..20ffc1fd4068 100644 --- a/clippy_lints/src/methods/mod.rs +++ b/clippy_lints/src/methods/mod.rs @@ -1313,13 +1313,13 @@ fn lint_clone_on_copy(cx: &LateContext<'_, '_>, expr: &hir::Expr, arg: &hir::Exp let refs: String = iter::repeat('&').take(n + 1).collect(); let derefs: String = iter::repeat('*').take(n).collect(); let explicit = format!("{}{}::clone({})", refs, ty, snip); - db.span_suggestion_with_applicability( + db.span_suggestion( expr.span, "try dereferencing it", format!("{}({}{}).clone()", refs, derefs, snip.deref()), Applicability::MaybeIncorrect, ); - db.span_suggestion_with_applicability( + db.span_suggestion( expr.span, "or try being explicit about what type to clone", explicit, @@ -1379,7 +1379,7 @@ fn lint_clone_on_copy(cx: &LateContext<'_, '_>, expr: &hir::Expr, arg: &hir::Exp } span_lint_and_then(cx, CLONE_ON_COPY, expr.span, "using `clone` on a `Copy` type", |db| { if let Some((text, snip)) = snip { - db.span_suggestion_with_applicability(expr.span, text, snip, Applicability::Unspecified); + db.span_suggestion(expr.span, text, snip, Applicability::Unspecified); } }); } @@ -1810,7 +1810,7 @@ fn lint_map_flatten<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr, let func_snippet = snippet(cx, map_args[1].span, ".."); let hint = format!("{0}.flat_map({1})", self_snippet, func_snippet); span_lint_and_then(cx, MAP_FLATTEN, expr.span, msg, |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( expr.span, "try using flat_map instead", hint, @@ -1897,7 +1897,7 @@ fn lint_map_or_none<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx hir::Expr, let map_or_func_snippet = snippet(cx, map_or_args[2].span, ".."); let hint = format!("{0}.and_then({1})", map_or_self_snippet, map_or_func_snippet); span_lint_and_then(cx, OPTION_MAP_OR_NONE, expr.span, msg, |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( expr.span, "try using and_then instead", hint, diff --git a/clippy_lints/src/misc.rs b/clippy_lints/src/misc.rs index 01f5a6333871..c15fba76869e 100644 --- a/clippy_lints/src/misc.rs +++ b/clippy_lints/src/misc.rs @@ -302,7 +302,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { l.pat.span, "`ref` on an entire `let` pattern is discouraged, take a reference with `&` instead", |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( s.span, "try", format!( @@ -330,7 +330,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { "boolean short circuit operator in statement may be clearer using an explicit test", |db| { let sugg = if binop.node == BinOpKind::Or { !sugg } else { sugg }; - db.span_suggestion_with_applicability( + db.span_suggestion( s.span, "replace it with", format!( @@ -387,7 +387,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { let lhs = Sugg::hir(cx, left, ".."); let rhs = Sugg::hir(cx, right, ".."); - db.span_suggestion_with_applicability( + db.span_suggestion( expr.span, "consider comparing them within some error", format!("({}).abs() < error", lhs - rhs), @@ -568,7 +568,7 @@ fn check_to_owned(cx: &LateContext<'_, '_>, expr: &Expr, other: &Expr) { snip.to_string() }; - db.span_suggestion_with_applicability( + db.span_suggestion( lint_span, "try", try_hint, diff --git a/clippy_lints/src/misc_early.rs b/clippy_lints/src/misc_early.rs index eb35da05908e..88acdbb168ab 100644 --- a/clippy_lints/src/misc_early.rs +++ b/clippy_lints/src/misc_early.rs @@ -343,7 +343,7 @@ impl EarlyLintPass for MiscEarly { |db| { if decl.inputs.is_empty() { let hint = snippet(cx, block.span, "..").into_owned(); - db.span_suggestion_with_applicability( + db.span_suggestion( expr.span, "Try doing something like: ", hint, @@ -438,13 +438,13 @@ impl MiscEarly { lit.span, "this is a decimal constant", |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( lit.span, "if you mean to use a decimal constant, remove the `0` to remove confusion", src.trim_start_matches(|c| c == '_' || c == '0').to_string(), Applicability::MaybeIncorrect, ); - db.span_suggestion_with_applicability( + db.span_suggestion( lit.span, "if you mean to use an octal constant, use `0o`", format!("0o{}", src.trim_start_matches(|c| c == '_' || c == '0')), diff --git a/clippy_lints/src/needless_borrow.rs b/clippy_lints/src/needless_borrow.rs index a35f31a98033..206a1465a46f 100644 --- a/clippy_lints/src/needless_borrow.rs +++ b/clippy_lints/src/needless_borrow.rs @@ -70,7 +70,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBorrow { by the compiler", |db| { if let Some(snippet) = snippet_opt(cx, inner.span) { - db.span_suggestion_with_applicability( + db.span_suggestion( e.span, "change this to", snippet, @@ -103,7 +103,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBorrow { "this pattern creates a reference to a reference", |db| { if let Some(snippet) = snippet_opt(cx, name.span) { - db.span_suggestion_with_applicability( + db.span_suggestion( pat.span, "change this to", snippet, diff --git a/clippy_lints/src/needless_borrowed_ref.rs b/clippy_lints/src/needless_borrowed_ref.rs index 6a0032f91b36..bf2857d92881 100644 --- a/clippy_lints/src/needless_borrowed_ref.rs +++ b/clippy_lints/src/needless_borrowed_ref.rs @@ -82,7 +82,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessBorrowedRef { "this pattern takes a reference on something that is being de-referenced", |db| { let hint = snippet(cx, spanned_name.span, "..").into_owned(); - db.span_suggestion_with_applicability( + db.span_suggestion( pat.span, "try removing the `&ref` part and just keep", hint, diff --git a/clippy_lints/src/needless_pass_by_value.rs b/clippy_lints/src/needless_pass_by_value.rs index 88eb36534b5d..73c0ed72d3b4 100644 --- a/clippy_lints/src/needless_pass_by_value.rs +++ b/clippy_lints/src/needless_pass_by_value.rs @@ -237,7 +237,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue { }).unwrap()); then { let slice_ty = format!("&[{}]", snippet(cx, elem_ty.span, "_")); - db.span_suggestion_with_applicability( + db.span_suggestion( input.span, "consider changing the type to", slice_ty, @@ -245,7 +245,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue { ); for (span, suggestion) in clone_spans { - db.span_suggestion_with_applicability( + db.span_suggestion( span, &snippet_opt(cx, span) .map_or( @@ -266,7 +266,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue { if match_type(cx, ty, &paths::STRING) { if let Some(clone_spans) = get_spans(cx, Some(body.id()), idx, &[("clone", ".to_string()"), ("as_str", "")]) { - db.span_suggestion_with_applicability( + db.span_suggestion( input.span, "consider changing the type to", "&str".to_string(), @@ -274,7 +274,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for NeedlessPassByValue { ); for (span, suggestion) in clone_spans { - db.span_suggestion_with_applicability( + db.span_suggestion( span, &snippet_opt(cx, span) .map_or( diff --git a/clippy_lints/src/non_copy_const.rs b/clippy_lints/src/non_copy_const.rs index cbf6099dd7dd..50d8b69ffae8 100644 --- a/clippy_lints/src/non_copy_const.rs +++ b/clippy_lints/src/non_copy_const.rs @@ -122,7 +122,7 @@ fn verify_ty_bound<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ty: ty::Ty<'tcx>, sourc match source { Source::Item { .. } => { let const_kw_span = span.from_inner_byte_pos(0, 5); - db.span_suggestion_with_applicability( + db.span_suggestion( const_kw_span, "make this a static item", "static".to_string(), diff --git a/clippy_lints/src/ptr.rs b/clippy_lints/src/ptr.rs index 6b2528248b54..8f4ee74258ad 100644 --- a/clippy_lints/src/ptr.rs +++ b/clippy_lints/src/ptr.rs @@ -182,7 +182,7 @@ fn check_fn(cx: &LateContext<'_, '_>, decl: &FnDecl, fn_id: NodeId, opt_body_id: with non-Vec-based slices.", |db| { if let Some(ref snippet) = ty_snippet { - db.span_suggestion_with_applicability( + db.span_suggestion( arg.span, "change this to", format!("&[{}]", snippet), @@ -190,7 +190,7 @@ fn check_fn(cx: &LateContext<'_, '_>, decl: &FnDecl, fn_id: NodeId, opt_body_id: ); } for (clonespan, suggestion) in spans { - db.span_suggestion_with_applicability( + db.span_suggestion( clonespan, &snippet_opt(cx, clonespan).map_or("change the call to".into(), |x| { Cow::Owned(format!("change `{}` to", x)) @@ -210,14 +210,14 @@ fn check_fn(cx: &LateContext<'_, '_>, decl: &FnDecl, fn_id: NodeId, opt_body_id: arg.span, "writing `&String` instead of `&str` involves a new object where a slice will do.", |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( arg.span, "change this to", "&str".into(), Applicability::Unspecified, ); for (clonespan, suggestion) in spans { - db.span_suggestion_short_with_applicability( + db.span_suggestion_short( clonespan, &snippet_opt(cx, clonespan).map_or("change the call to".into(), |x| { Cow::Owned(format!("change `{}` to", x)) @@ -250,7 +250,7 @@ fn check_fn(cx: &LateContext<'_, '_>, decl: &FnDecl, fn_id: NodeId, opt_body_id: arg.span, "using a reference to `Cow` is not recommended.", |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( arg.span, "change this to", "&".to_owned() + &r, diff --git a/clippy_lints/src/question_mark.rs b/clippy_lints/src/question_mark.rs index b30cbe4ce9a5..cab133943a34 100644 --- a/clippy_lints/src/question_mark.rs +++ b/clippy_lints/src/question_mark.rs @@ -92,7 +92,7 @@ impl Pass { expr.span, "this block may be rewritten with the `?` operator", |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( expr.span, "replace_it_with", replacement_str, diff --git a/clippy_lints/src/ranges.rs b/clippy_lints/src/ranges.rs index ef600184ebe2..acd2a3ebc65e 100644 --- a/clippy_lints/src/ranges.rs +++ b/clippy_lints/src/ranges.rs @@ -166,14 +166,14 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { let end = Sugg::hir(cx, y, "y"); if let Some(is_wrapped) = &snippet_opt(cx, expr.span) { if is_wrapped.starts_with('(') && is_wrapped.ends_with(')') { - db.span_suggestion_with_applicability( + db.span_suggestion( expr.span, "use", format!("({}..={})", start, end), Applicability::MaybeIncorrect, ); } else { - db.span_suggestion_with_applicability( + db.span_suggestion( expr.span, "use", format!("{}..={}", start, end), @@ -199,7 +199,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Pass { |db| { let start = start.map_or(String::new(), |x| Sugg::hir(cx, x, "x").to_string()); let end = Sugg::hir(cx, y, "y"); - db.span_suggestion_with_applicability( + db.span_suggestion( expr.span, "use", format!("{}..{}", start, end), diff --git a/clippy_lints/src/redundant_clone.rs b/clippy_lints/src/redundant_clone.rs index 59d1a4297a5c..7ac147c8ac17 100644 --- a/clippy_lints/src/redundant_clone.rs +++ b/clippy_lints/src/redundant_clone.rs @@ -202,7 +202,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for RedundantClone { ); span_lint_node_and_then(cx, REDUNDANT_CLONE, node, sugg_span, "redundant clone", |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( sugg_span, "remove this", String::new(), diff --git a/clippy_lints/src/redundant_pattern_matching.rs b/clippy_lints/src/redundant_pattern_matching.rs index 1cf0838415f4..8f833a893dfc 100644 --- a/clippy_lints/src/redundant_pattern_matching.rs +++ b/clippy_lints/src/redundant_pattern_matching.rs @@ -98,7 +98,7 @@ fn find_sugg_for_if_let<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr, &format!("redundant pattern matching, consider using `{}`", good_method), |db| { let span = expr.span.to(op.span); - db.span_suggestion_with_applicability( + db.span_suggestion( span, "try this", format!("if {}.{}", snippet(cx, op.span, "_"), good_method), @@ -163,7 +163,7 @@ fn find_sugg_for_match<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, expr: &'tcx Expr, o &format!("redundant pattern matching, consider using `{}`", good_method), |db| { let span = expr.span.to(op.span); - db.span_suggestion_with_applicability( + db.span_suggestion( span, "try this", format!("{}.{}", snippet(cx, op.span, "_"), good_method), diff --git a/clippy_lints/src/returns.rs b/clippy_lints/src/returns.rs index 83b4d7f91120..71ef3e4bfa03 100644 --- a/clippy_lints/src/returns.rs +++ b/clippy_lints/src/returns.rs @@ -135,7 +135,7 @@ impl ReturnPass { } span_lint_and_then(cx, NEEDLESS_RETURN, ret_span, "unneeded return statement", |db| { if let Some(snippet) = snippet_opt(cx, inner_span) { - db.span_suggestion_with_applicability( + db.span_suggestion( ret_span, "remove `return` as shown", snippet, @@ -211,7 +211,7 @@ impl EarlyLintPass for ReturnPass { (ty.span, Applicability::MaybeIncorrect) }; span_lint_and_then(cx, UNUSED_UNIT, rspan, "unneeded unit return type", |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( rspan, "remove the `-> ()`", String::new(), @@ -231,7 +231,7 @@ impl EarlyLintPass for ReturnPass { then { let sp = expr.span; span_lint_and_then(cx, UNUSED_UNIT, sp, "unneeded unit expression", |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( sp, "remove the final `()`", String::new(), @@ -247,7 +247,7 @@ impl EarlyLintPass for ReturnPass { ast::ExprKind::Ret(Some(ref expr)) | ast::ExprKind::Break(_, Some(ref expr)) => { if is_unit_expr(expr) && !in_macro(expr.span) { span_lint_and_then(cx, UNUSED_UNIT, expr.span, "unneeded `()`", |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( expr.span, "remove the `()`", String::new(), diff --git a/clippy_lints/src/slow_vector_initialization.rs b/clippy_lints/src/slow_vector_initialization.rs index 0765e4e11bed..4ce9ce3e2ff2 100644 --- a/clippy_lints/src/slow_vector_initialization.rs +++ b/clippy_lints/src/slow_vector_initialization.rs @@ -179,7 +179,7 @@ impl Pass { let len_expr = Sugg::hir(cx, vec_alloc.len_expr, "len"); span_lint_and_then(cx, lint, slow_fill.span, msg, |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( vec_alloc.allocation_expr.span, "consider replace allocation with", format!("vec![0; {}]", len_expr), diff --git a/clippy_lints/src/swap.rs b/clippy_lints/src/swap.rs index 860707c82395..af7fd11c6e58 100644 --- a/clippy_lints/src/swap.rs +++ b/clippy_lints/src/swap.rs @@ -142,7 +142,7 @@ fn check_manual_swap(cx: &LateContext<'_, '_>, block: &Block) { &format!("this looks like you are swapping{} manually", what), |db| { if !sugg.is_empty() { - db.span_suggestion_with_applicability( + db.span_suggestion( span, "try", sugg, @@ -191,7 +191,7 @@ fn check_suspicious_swap(cx: &LateContext<'_, '_>, block: &Block) { &format!("this looks like you are trying to swap{}", what), |db| { if !what.is_empty() { - db.span_suggestion_with_applicability( + db.span_suggestion( span, "try", format!( diff --git a/clippy_lints/src/transmute.rs b/clippy_lints/src/transmute.rs index 88371df0dca5..80bc29a3553a 100644 --- a/clippy_lints/src/transmute.rs +++ b/clippy_lints/src/transmute.rs @@ -260,7 +260,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Transmute { arg.as_ty(cx.tcx.mk_ptr(rty_and_mut)).as_ty(to_ty) }; - db.span_suggestion_with_applicability( + db.span_suggestion( e.span, "try", sugg.to_string(), @@ -276,7 +276,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Transmute { "transmute from an integer to a pointer", |db| { if let Some(arg) = sugg::Sugg::hir_opt(cx, &args[0]) { - db.span_suggestion_with_applicability( + db.span_suggestion( e.span, "try", arg.as_ty(&to_ty.to_string()).to_string(), @@ -335,7 +335,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Transmute { arg.as_ty(&format!("{} {}", cast, get_type_snippet(cx, qpath, to_ref_ty))) }; - db.span_suggestion_with_applicability( + db.span_suggestion( e.span, "try", sugg::make_unop(deref, arg).to_string(), @@ -356,7 +356,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Transmute { } else { arg }; - db.span_suggestion_with_applicability( + db.span_suggestion( e.span, "consider using", format!("std::char::from_u32({}).unwrap()", arg.to_string()), @@ -383,7 +383,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Transmute { e.span, &format!("transmute from a `{}` to a `{}`", from_ty, to_ty), |db| { - db.span_suggestion_with_applicability( + db.span_suggestion( e.span, "consider using", format!( @@ -416,7 +416,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Transmute { } else { sugg_paren.addr_deref() }; - db.span_suggestion_with_applicability( + db.span_suggestion( e.span, "try", sugg.to_string(), @@ -436,7 +436,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Transmute { |db| { if let Some(arg) = sugg::Sugg::hir_opt(cx, &args[0]) { let sugg = arg.as_ty(cx.tcx.mk_ptr(to_ty)); - db.span_suggestion_with_applicability( + db.span_suggestion( e.span, "try", sugg.to_string(), @@ -454,7 +454,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Transmute { |db| { let arg = sugg::Sugg::hir(cx, &args[0], ".."); let zero = sugg::Sugg::NonParen(Cow::from("0")); - db.span_suggestion_with_applicability( + db.span_suggestion( e.span, "consider using", sugg::make_binop(ast::BinOpKind::Ne, &arg, &zero).to_string(), @@ -478,7 +478,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Transmute { } else { arg }; - db.span_suggestion_with_applicability( + db.span_suggestion( e.span, "consider using", format!("{}::from_bits({})", to_ty, arg.to_string()), diff --git a/clippy_lints/src/utils/mod.rs b/clippy_lints/src/utils/mod.rs index c83b0f155fca..af9b1599649d 100644 --- a/clippy_lints/src/utils/mod.rs +++ b/clippy_lints/src/utils/mod.rs @@ -693,7 +693,7 @@ pub fn span_lint_and_sugg<'a, 'tcx: 'a, T: LintContext<'tcx>>( applicability: Applicability, ) { span_lint_and_then(cx, lint, sp, msg, |db| { - db.span_suggestion_with_applicability(sp, help, sugg, applicability); + db.span_suggestion(sp, help, sugg, applicability); }); } diff --git a/clippy_lints/src/utils/sugg.rs b/clippy_lints/src/utils/sugg.rs index b95ce17ed93d..166470876c98 100644 --- a/clippy_lints/src/utils/sugg.rs +++ b/clippy_lints/src/utils/sugg.rs @@ -547,7 +547,7 @@ impl<'a, 'b, 'c, T: LintContext<'c>> DiagnosticBuilderExt<'c, T> for rustc_error if let Some(indent) = indentation(cx, item) { let span = item.with_hi(item.lo()); - self.span_suggestion_with_applicability(span, msg, format!("{}\n{}", attr, indent), applicability); + self.span_suggestion(span, msg, format!("{}\n{}", attr, indent), applicability); } } @@ -568,7 +568,7 @@ impl<'a, 'b, 'c, T: LintContext<'c>> DiagnosticBuilderExt<'c, T> for rustc_error }) .collect::(); - self.span_suggestion_with_applicability(span, msg, format!("{}\n{}", new_item, indent), applicability); + self.span_suggestion(span, msg, format!("{}\n{}", new_item, indent), applicability); } } @@ -586,7 +586,7 @@ impl<'a, 'b, 'c, T: LintContext<'c>> DiagnosticBuilderExt<'c, T> for rustc_error } } - self.span_suggestion_with_applicability(remove_span, msg, String::new(), applicability); + self.span_suggestion(remove_span, msg, String::new(), applicability); } } From 79b1d9adf0d09ae49df72648ab3d5c03536c0de2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 27 Jan 2019 13:34:23 +0100 Subject: [PATCH 3/4] run cargo fmt --- clippy_lints/src/ptr.rs | 7 +------ clippy_lints/src/transmute.rs | 14 ++------------ 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/clippy_lints/src/ptr.rs b/clippy_lints/src/ptr.rs index 8f4ee74258ad..b990b7ab2bd3 100644 --- a/clippy_lints/src/ptr.rs +++ b/clippy_lints/src/ptr.rs @@ -210,12 +210,7 @@ fn check_fn(cx: &LateContext<'_, '_>, decl: &FnDecl, fn_id: NodeId, opt_body_id: arg.span, "writing `&String` instead of `&str` involves a new object where a slice will do.", |db| { - db.span_suggestion( - arg.span, - "change this to", - "&str".into(), - Applicability::Unspecified, - ); + db.span_suggestion(arg.span, "change this to", "&str".into(), Applicability::Unspecified); for (clonespan, suggestion) in spans { db.span_suggestion_short( clonespan, diff --git a/clippy_lints/src/transmute.rs b/clippy_lints/src/transmute.rs index 80bc29a3553a..90cfcd56c3b0 100644 --- a/clippy_lints/src/transmute.rs +++ b/clippy_lints/src/transmute.rs @@ -260,12 +260,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Transmute { arg.as_ty(cx.tcx.mk_ptr(rty_and_mut)).as_ty(to_ty) }; - db.span_suggestion( - e.span, - "try", - sugg.to_string(), - Applicability::Unspecified, - ); + db.span_suggestion(e.span, "try", sugg.to_string(), Applicability::Unspecified); } }, ), @@ -436,12 +431,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for Transmute { |db| { if let Some(arg) = sugg::Sugg::hir_opt(cx, &args[0]) { let sugg = arg.as_ty(cx.tcx.mk_ptr(to_ty)); - db.span_suggestion( - e.span, - "try", - sugg.to_string(), - Applicability::Unspecified, - ); + db.span_suggestion(e.span, "try", sugg.to_string(), Applicability::Unspecified); } }, ), From 16c0a2fa6fc34380b60a54282e7e2ec1dafa2f48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matthias=20Kr=C3=BCger?= Date: Sun, 27 Jan 2019 13:46:22 +0100 Subject: [PATCH 4/4] update test stderr --- tests/ui/deprecated.stderr | 8 +++++++- tests/ui/rename.stderr | 14 +++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/tests/ui/deprecated.stderr b/tests/ui/deprecated.stderr index 4dbca0dea64b..ea809472cb28 100644 --- a/tests/ui/deprecated.stderr +++ b/tests/ui/deprecated.stderr @@ -30,5 +30,11 @@ error: lint `misaligned_transmute` has been removed: `this lint has been split i LL | #[warn(misaligned_transmute)] | ^^^^^^^^^^^^^^^^^^^^ -error: aborting due to 5 previous errors +error: lint `str_to_string` has been removed: `using `str::to_string` is common even today and specialization will likely happen soon` + --> $DIR/deprecated.rs:1:8 + | +LL | #[warn(str_to_string)] + | ^^^^^^^^^^^^^ + +error: aborting due to 6 previous errors diff --git a/tests/ui/rename.stderr b/tests/ui/rename.stderr index 58d2c98f8901..7864e2a1fca2 100644 --- a/tests/ui/rename.stderr +++ b/tests/ui/rename.stderr @@ -20,5 +20,17 @@ error: lint `clippy::new_without_default_derive` has been renamed to `clippy::ne LL | #[warn(clippy::new_without_default_derive)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ help: use the new name: `clippy::new_without_default` -error: aborting due to 3 previous errors +error: unknown lint: `stutter` + --> $DIR/rename.rs:1:10 + | +LL | #![allow(stutter)] + | ^^^^^^^ + +error: lint `clippy::stutter` has been renamed to `clippy::module_name_repetitions` + --> $DIR/rename.rs:3:8 + | +LL | #[warn(clippy::stutter)] + | ^^^^^^^^^^^^^^^ help: use the new name: `clippy::module_name_repetitions` + +error: aborting due to 5 previous errors