Skip to content

Commit

Permalink
Auto merge of #3705 - matthiaskrgr:rustup, r=phansch
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed Jan 27, 2019
2 parents e3270c6 + 16c0a2f commit 13421e3
Show file tree
Hide file tree
Showing 133 changed files with 696 additions and 109 deletions.
4 changes: 4 additions & 0 deletions clippy_lints/src/approx_const.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions clippy_lints/src/arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions clippy_lints/src/assertions_on_constants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 7 additions & 3 deletions clippy_lints/src/assign_ops.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -79,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",
Expand All @@ -92,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,
Expand Down Expand Up @@ -179,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),
Expand Down
12 changes: 10 additions & 2 deletions clippy_lints/src/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -269,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,
Expand Down Expand Up @@ -332,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,
Expand Down Expand Up @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion clippy_lints/src/bit_mask.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -139,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()),
Expand Down
3 changes: 3 additions & 0 deletions clippy_lints/src/blacklisted_name.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions clippy_lints/src/block_in_if_condition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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> {
Expand Down
8 changes: 6 additions & 2 deletions clippy_lints/src/booleans.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -389,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,
Expand Down Expand Up @@ -419,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(),
Expand Down
4 changes: 4 additions & 0 deletions clippy_lints/src/bytecount.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions clippy_lints/src/cargo_common_metadata.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
6 changes: 5 additions & 1 deletion clippy_lints/src/collapsible_if.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -150,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!(
Expand Down
6 changes: 5 additions & 1 deletion clippy_lints/src/const_static_lifetime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -62,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,
Expand Down
6 changes: 5 additions & 1 deletion clippy_lints/src/copies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -203,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
Expand Down
4 changes: 4 additions & 0 deletions clippy_lints/src/copy_iterator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions clippy_lints/src/cyclomatic_complexity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions clippy_lints/src/default_trait_access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions clippy_lints/src/derive.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions clippy_lints/src/doc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions clippy_lints/src/double_comparison.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions clippy_lints/src/double_parens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions clippy_lints/src/drop_forget_ref.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions clippy_lints/src/duration_subsec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions clippy_lints/src/else_if_without_else.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 4 additions & 0 deletions clippy_lints/src/empty_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
Loading

0 comments on commit 13421e3

Please sign in to comment.