Skip to content

Commit

Permalink
Auto merge of rust-lang#5098 - JohnTitor:rename-span-lints, r=flip1995
Browse files Browse the repository at this point in the history
Rename `span_{help, note}_and_lint` to `span_lint_and_*`

`span_*_and_lint` and `span_lint_and_*` make us confused. The order should be the same.

[context](rust-lang#5084 (comment))

changelog: none
  • Loading branch information
bors committed Jan 27, 2020
2 parents 4f65bec + f5e86d6 commit 5e722ba
Show file tree
Hide file tree
Showing 36 changed files with 113 additions and 113 deletions.
4 changes: 2 additions & 2 deletions clippy_lints/src/as_conversions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
use rustc_session::{declare_lint_pass, declare_tool_lint};
use syntax::ast::*;

use crate::utils::span_help_and_lint;
use crate::utils::span_lint_and_help;

declare_clippy_lint! {
/// **What it does:** Checks for usage of `as` conversions.
Expand Down Expand Up @@ -45,7 +45,7 @@ impl EarlyLintPass for AsConversions {
}

if let ExprKind::Cast(_, _) = expr.kind {
span_help_and_lint(
span_lint_and_help(
cx,
AS_CONVERSIONS,
expr.span,
Expand Down
8 changes: 4 additions & 4 deletions clippy_lints/src/assertions_on_constants.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::consts::{constant, Constant};
use crate::utils::paths;
use crate::utils::{is_direct_expn_of, is_expn_of, match_function_call, snippet_opt, span_help_and_lint};
use crate::utils::{is_direct_expn_of, is_expn_of, match_function_call, snippet_opt, span_lint_and_help};
use if_chain::if_chain;
use rustc_hir::*;
use rustc_lint::{LateContext, LateLintPass};
Expand Down Expand Up @@ -34,7 +34,7 @@ declare_lint_pass!(AssertionsOnConstants => [ASSERTIONS_ON_CONSTANTS]);
impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssertionsOnConstants {
fn check_expr(&mut self, cx: &LateContext<'a, 'tcx>, e: &'tcx Expr<'_>) {
let lint_true = |is_debug: bool| {
span_help_and_lint(
span_lint_and_help(
cx,
ASSERTIONS_ON_CONSTANTS,
e.span,
Expand All @@ -47,7 +47,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssertionsOnConstants {
);
};
let lint_false_without_message = || {
span_help_and_lint(
span_lint_and_help(
cx,
ASSERTIONS_ON_CONSTANTS,
e.span,
Expand All @@ -56,7 +56,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for AssertionsOnConstants {
);
};
let lint_false_with_message = |panic_message: String| {
span_help_and_lint(
span_lint_and_help(
cx,
ASSERTIONS_ON_CONSTANTS,
e.span,
Expand Down
8 changes: 4 additions & 4 deletions clippy_lints/src/atomic_ordering.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::utils::{match_def_path, span_help_and_lint};
use crate::utils::{match_def_path, span_lint_and_help};
use if_chain::if_chain;
use rustc::ty;
use rustc_hir::def_id::DefId;
Expand Down Expand Up @@ -80,7 +80,7 @@ fn check_atomic_load_store(cx: &LateContext<'_, '_>, expr: &Expr<'_>) {
then {
if method == "load" &&
match_ordering_def_path(cx, ordering_def_id, &["Release", "AcqRel"]) {
span_help_and_lint(
span_lint_and_help(
cx,
INVALID_ATOMIC_ORDERING,
ordering_arg.span,
Expand All @@ -89,7 +89,7 @@ fn check_atomic_load_store(cx: &LateContext<'_, '_>, expr: &Expr<'_>) {
);
} else if method == "store" &&
match_ordering_def_path(cx, ordering_def_id, &["Acquire", "AcqRel"]) {
span_help_and_lint(
span_lint_and_help(
cx,
INVALID_ATOMIC_ORDERING,
ordering_arg.span,
Expand All @@ -113,7 +113,7 @@ fn check_memory_fence(cx: &LateContext<'_, '_>, expr: &Expr<'_>) {
if let Some(ordering_def_id) = cx.tables.qpath_res(ordering_qpath, args[0].hir_id).opt_def_id();
if match_ordering_def_path(cx, ordering_def_id, &["Relaxed"]);
then {
span_help_and_lint(
span_lint_and_help(
cx,
INVALID_ATOMIC_ORDERING,
args[0].span,
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/block_in_if_condition.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BlockInIfCondition {
if expr.span.from_expansion() || differing_macro_contexts(expr.span, ex.span) {
return;
}
span_help_and_lint(
span_lint_and_help(
cx,
BLOCK_IN_IF_CONDITION_EXPR,
check.span,
Expand All @@ -107,7 +107,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for BlockInIfCondition {
return;
}
// move block higher
span_help_and_lint(
span_lint_and_help(
cx,
BLOCK_IN_IF_CONDITION_STMT,
check.span,
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/cognitive_complexity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use rustc_span::source_map::Span;
use rustc_span::BytePos;
use syntax::ast::Attribute;

use crate::utils::{match_type, paths, snippet_opt, span_help_and_lint, LimitStack};
use crate::utils::{match_type, paths, snippet_opt, span_lint_and_help, LimitStack};

declare_clippy_lint! {
/// **What it does:** Checks for methods with high cognitive complexity.
Expand Down Expand Up @@ -96,7 +96,7 @@ impl CognitiveComplexity {
},
};

span_help_and_lint(
span_lint_and_help(
cx,
COGNITIVE_COMPLEXITY,
fn_span,
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/comparison_chain.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::utils::{
get_trait_def_id, if_sequence, implements_trait, parent_node_is_if_expr, paths, span_help_and_lint, SpanlessEq,
get_trait_def_id, if_sequence, implements_trait, parent_node_is_if_expr, paths, span_lint_and_help, SpanlessEq,
};
use rustc_hir::*;
use rustc_lint::{LateContext, LateLintPass};
Expand Down Expand Up @@ -99,7 +99,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for ComparisonChain {
return;
}
}
span_help_and_lint(
span_lint_and_help(
cx,
COMPARISON_CHAIN,
expr.span,
Expand Down
8 changes: 4 additions & 4 deletions clippy_lints/src/copies.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::utils::{get_parent_expr, higher, if_sequence, same_tys, snippet, span_lint_and_then, span_note_and_lint};
use crate::utils::{get_parent_expr, higher, if_sequence, same_tys, snippet, span_lint_and_note, span_lint_and_then};
use crate::utils::{SpanlessEq, SpanlessHash};
use rustc::ty::Ty;
use rustc_data_structures::fx::FxHashMap;
Expand Down Expand Up @@ -178,7 +178,7 @@ fn lint_same_then_else(cx: &LateContext<'_, '_>, blocks: &[&Block<'_>]) {
&|&lhs, &rhs| -> bool { SpanlessEq::new(cx).eq_block(lhs, rhs) };

if let Some((i, j)) = search_same_sequenced(blocks, eq) {
span_note_and_lint(
span_lint_and_note(
cx,
IF_SAME_THEN_ELSE,
j.span,
Expand All @@ -201,7 +201,7 @@ fn lint_same_cond(cx: &LateContext<'_, '_>, conds: &[&Expr<'_>]) {
&|&lhs, &rhs| -> bool { SpanlessEq::new(cx).ignore_fn().eq_expr(lhs, rhs) };

for (i, j) in search_same(conds, hash, eq) {
span_note_and_lint(
span_lint_and_note(
cx,
IFS_SAME_COND,
j.span,
Expand Down Expand Up @@ -229,7 +229,7 @@ fn lint_same_fns_in_if_cond(cx: &LateContext<'_, '_>, conds: &[&Expr<'_>]) {
};

for (i, j) in search_same(conds, hash, eq) {
span_note_and_lint(
span_lint_and_note(
cx,
SAME_FUNCTIONS_IN_IF_CONDITION,
j.span,
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/copy_iterator.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::utils::{is_copy, match_path, paths, span_note_and_lint};
use crate::utils::{is_copy, match_path, paths, span_lint_and_note};
use rustc_hir::{Item, ItemKind};
use rustc_lint::{LateContext, LateLintPass};
use rustc_session::{declare_lint_pass, declare_tool_lint};
Expand Down Expand Up @@ -41,7 +41,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CopyIterator {
let ty = cx.tcx.type_of(cx.tcx.hir().local_def_id(item.hir_id));

if is_copy(cx, ty) && match_path(&trait_ref.path, &paths::ITERATOR) {
span_note_and_lint(
span_lint_and_note(
cx,
COPY_ITERATOR,
item.span,
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/dbg_macro.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::utils::{snippet_opt, span_help_and_lint, span_lint_and_sugg};
use crate::utils::{snippet_opt, span_lint_and_help, span_lint_and_sugg};
use rustc_errors::Applicability;
use rustc_lint::{EarlyContext, EarlyLintPass};
use rustc_session::{declare_lint_pass, declare_tool_lint};
Expand Down Expand Up @@ -43,7 +43,7 @@ impl EarlyLintPass for DbgMacro {
Applicability::MaybeIncorrect,
);
} else {
span_help_and_lint(
span_lint_and_help(
cx,
DBG_MACRO,
mac.span(),
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/drop_forget_ref.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::utils::{is_copy, match_def_path, paths, qpath_res, span_note_and_lint};
use crate::utils::{is_copy, match_def_path, paths, qpath_res, span_lint_and_note};
use if_chain::if_chain;
use rustc::ty;
use rustc_hir::*;
Expand Down Expand Up @@ -131,7 +131,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DropForgetRef {
} else {
return;
}
span_note_and_lint(cx,
span_lint_and_note(cx,
lint,
expr.span,
&msg,
Expand All @@ -147,7 +147,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DropForgetRef {
} else {
return;
}
span_note_and_lint(cx,
span_lint_and_note(cx,
lint,
expr.span,
&msg,
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/else_if_without_else.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
use rustc_session::{declare_lint_pass, declare_tool_lint};
use syntax::ast::*;

use crate::utils::span_help_and_lint;
use crate::utils::span_lint_and_help;

declare_clippy_lint! {
/// **What it does:** Checks for usage of if expressions with an `else if` branch,
Expand Down Expand Up @@ -56,7 +56,7 @@ impl EarlyLintPass for ElseIfWithoutElse {

while let ExprKind::If(_, _, Some(ref els)) = item.kind {
if let ExprKind::If(_, _, None) = els.kind {
span_help_and_lint(
span_lint_and_help(
cx,
ELSE_IF_WITHOUT_ELSE,
els.span,
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/enum_variants.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! lint on enum variants that are prefixed or suffixed by the same characters
use crate::utils::{camel_case, is_present_in_source};
use crate::utils::{span_help_and_lint, span_lint};
use crate::utils::{span_lint, span_lint_and_help};
use rustc_lint::{EarlyContext, EarlyLintPass, Lint};
use rustc_session::{declare_tool_lint, impl_lint_pass};
use rustc_span::source_map::Span;
Expand Down Expand Up @@ -201,7 +201,7 @@ fn check_variant(
(false, _) => ("pre", pre),
(true, false) => ("post", post),
};
span_help_and_lint(
span_lint_and_help(
cx,
lint,
span,
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/eval_order_dependence.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::utils::{get_parent_expr, span_lint, span_note_and_lint};
use crate::utils::{get_parent_expr, span_lint, span_lint_and_note};
use if_chain::if_chain;
use rustc::hir::map::Map;
use rustc::ty;
Expand Down Expand Up @@ -307,7 +307,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ReadVisitor<'a, 'tcx> {
// Check that this is a read, not a write.
if !is_in_assignment_position(self.cx, expr);
then {
span_note_and_lint(
span_lint_and_note(
self.cx,
EVAL_ORDER_DEPENDENCE,
expr.span,
Expand Down
12 changes: 6 additions & 6 deletions clippy_lints/src/formatting.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::utils::{differing_macro_contexts, snippet_opt, span_help_and_lint, span_note_and_lint};
use crate::utils::{differing_macro_contexts, snippet_opt, span_lint_and_help, span_lint_and_note};
use if_chain::if_chain;
use rustc::lint::in_external_macro;
use rustc_lint::{EarlyContext, EarlyLintPass};
Expand Down Expand Up @@ -140,7 +140,7 @@ fn check_assign(cx: &EarlyContext<'_>, expr: &Expr) {
let op = UnOp::to_string(op);
let eqop_span = lhs.span.between(sub_rhs.span);
if eq_snippet.ends_with('=') {
span_note_and_lint(
span_lint_and_note(
cx,
SUSPICIOUS_ASSIGNMENT_FORMATTING,
eqop_span,
Expand Down Expand Up @@ -178,7 +178,7 @@ fn check_unop(cx: &EarlyContext<'_>, expr: &Expr) {
then {
let unop_str = UnOp::to_string(op);
let eqop_span = lhs.span.between(un_rhs.span);
span_help_and_lint(
span_lint_and_help(
cx,
SUSPICIOUS_UNARY_OP_FORMATTING,
eqop_span,
Expand Down Expand Up @@ -221,7 +221,7 @@ fn check_else(cx: &EarlyContext<'_>, expr: &Expr) {
let else_desc = if is_if(else_) { "if" } else { "{..}" };

then {
span_note_and_lint(
span_lint_and_note(
cx,
SUSPICIOUS_ELSE_FORMATTING,
else_span,
Expand Down Expand Up @@ -260,7 +260,7 @@ fn check_array(cx: &EarlyContext<'_>, expr: &Expr) {
if space_snippet.contains('\n');
if indentation(cx, op.span) <= indentation(cx, lhs.span);
then {
span_note_and_lint(
span_lint_and_note(
cx,
POSSIBLE_MISSING_COMMA,
lint_span,
Expand Down Expand Up @@ -291,7 +291,7 @@ fn check_missing_else(cx: &EarlyContext<'_>, first: &Expr, second: &Expr) {
("an `else {..}`", "the next block")
};

span_note_and_lint(
span_lint_and_note(
cx,
SUSPICIOUS_ELSE_FORMATTING,
else_span,
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/functions.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::utils::{
attr_by_name, attrs::is_proc_macro, is_must_use_ty, iter_input_pats, match_def_path, must_use_attr, qpath_res,
return_ty, snippet, snippet_opt, span_help_and_lint, span_lint, span_lint_and_then, trait_ref_of_method,
return_ty, snippet, snippet_opt, span_lint, span_lint_and_help, span_lint_and_then, trait_ref_of_method,
type_is_unsafe_function,
};
use matches::matches;
Expand Down Expand Up @@ -433,7 +433,7 @@ fn check_needless_must_use(
},
);
} else if !attr.is_value_str() && is_must_use_ty(cx, return_ty(cx, item_id)) {
span_help_and_lint(
span_lint_and_help(
cx,
DOUBLE_MUST_USE,
fn_header_span,
Expand Down
6 changes: 3 additions & 3 deletions clippy_lints/src/if_not_else.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use rustc_lint::{EarlyContext, EarlyLintPass, LintContext};
use rustc_session::{declare_lint_pass, declare_tool_lint};
use syntax::ast::*;

use crate::utils::span_help_and_lint;
use crate::utils::span_lint_and_help;

declare_clippy_lint! {
/// **What it does:** Checks for usage of `!` or `!=` in an if condition with an
Expand Down Expand Up @@ -56,7 +56,7 @@ impl EarlyLintPass for IfNotElse {
if let ExprKind::Block(..) = els.kind {
match cond.kind {
ExprKind::Unary(UnOp::Not, _) => {
span_help_and_lint(
span_lint_and_help(
cx,
IF_NOT_ELSE,
item.span,
Expand All @@ -65,7 +65,7 @@ impl EarlyLintPass for IfNotElse {
);
},
ExprKind::Binary(ref kind, _, _) if kind.node == BinOpKind::Ne => {
span_help_and_lint(
span_lint_and_help(
cx,
IF_NOT_ELSE,
item.span,
Expand Down
4 changes: 2 additions & 2 deletions clippy_lints/src/indexing_slicing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IndexingSlicing {
(None, None) => return, // [..] is ok.
};

utils::span_help_and_lint(cx, INDEXING_SLICING, expr.span, "slicing may panic.", help_msg);
utils::span_lint_and_help(cx, INDEXING_SLICING, expr.span, "slicing may panic.", help_msg);
} else {
// Catchall non-range index, i.e., [n] or [n << m]
if let ty::Array(..) = ty.kind {
Expand All @@ -147,7 +147,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for IndexingSlicing {
}
}

utils::span_help_and_lint(
utils::span_lint_and_help(
cx,
INDEXING_SLICING,
expr.span,
Expand Down
Loading

0 comments on commit 5e722ba

Please sign in to comment.