Rename span_note_and_lint to span_lint_and_note

This commit is contained in:
Yuki Okushi 2020-01-27 11:26:42 +09:00
parent f60f12f71f
commit f5e86d6894
9 changed files with 26 additions and 26 deletions

View File

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

View File

@ -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};
@ -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,

View File

@ -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::*;
@ -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,
@ -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,

View File

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

View File

@ -1,4 +1,4 @@
use crate::utils::{differing_macro_contexts, snippet_opt, span_lint_and_help, 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};
@ -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,
@ -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,
@ -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,
@ -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,

View File

@ -4,7 +4,7 @@ use crate::utils::sugg::Sugg;
use crate::utils::usage::is_unused;
use crate::utils::{
expr_block, is_allowed, is_expn_of, is_wild, match_qpath, match_type, multispan_sugg, remove_blocks, snippet,
snippet_with_applicability, span_lint_and_help, span_lint_and_sugg, span_lint_and_then, span_note_and_lint,
snippet_with_applicability, span_lint_and_help, span_lint_and_note, span_lint_and_sugg, span_lint_and_then,
walk_ptrs_ty,
};
use if_chain::if_chain;
@ -449,7 +449,7 @@ fn check_overlapping_arms<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ex: &'tcx Expr<'
let type_ranges = type_ranges(&ranges);
if !type_ranges.is_empty() {
if let Some((start, end)) = overlapping(&type_ranges) {
span_note_and_lint(
span_lint_and_note(
cx,
MATCH_OVERLAPPING_ARM,
start.span,
@ -488,7 +488,7 @@ fn check_wild_err_arm(cx: &LateContext<'_, '_>, ex: &Expr<'_>, arms: &[Arm<'_>])
if is_panic_block(block);
then {
// `Err(_)` or `Err(_e)` arm with `panic!` found
span_note_and_lint(cx,
span_lint_and_note(cx,
MATCH_WILD_ERR_ARM,
arm.pat.span,
&format!("`Err({})` matches all errors", &ident_bind_name),

View File

@ -28,8 +28,8 @@ use crate::utils::{
is_ctor_or_promotable_const_function, is_expn_of, is_type_diagnostic_item, iter_input_pats, last_path_segment,
match_def_path, match_qpath, match_trait_method, match_type, match_var, method_calls, method_chain_args, paths,
remove_blocks, return_ty, same_tys, single_segment_path, snippet, snippet_with_applicability,
snippet_with_macro_callsite, span_lint, span_lint_and_help, span_lint_and_sugg, span_lint_and_then,
span_note_and_lint, sugg, walk_ptrs_ty, walk_ptrs_ty_depth, SpanlessEq,
snippet_with_macro_callsite, span_lint, span_lint_and_help, span_lint_and_note, span_lint_and_sugg,
span_lint_and_then, sugg, walk_ptrs_ty, walk_ptrs_ty_depth, SpanlessEq,
};
declare_clippy_lint! {
@ -2422,7 +2422,7 @@ fn lint_map_unwrap_or_else<'a, 'tcx>(
let multiline = map_snippet.lines().count() > 1 || unwrap_snippet.lines().count() > 1;
let same_span = map_args[1].span.ctxt() == unwrap_args[1].span.ctxt();
if same_span && !multiline {
span_note_and_lint(
span_lint_and_note(
cx,
if is_option {
OPTION_MAP_UNWRAP_OR_ELSE
@ -2566,7 +2566,7 @@ fn lint_filter_next<'a, 'tcx>(
let filter_snippet = snippet(cx, filter_args[1].span, "..");
if filter_snippet.lines().count() <= 1 {
// add note if not multi-line
span_note_and_lint(
span_lint_and_note(
cx,
FILTER_NEXT,
expr.span,
@ -2624,7 +2624,7 @@ fn lint_filter_map_next<'a, 'tcx>(
`.find_map(p)` instead.";
let filter_snippet = snippet(cx, filter_args[1].span, "..");
if filter_snippet.lines().count() <= 1 {
span_note_and_lint(
span_lint_and_note(
cx,
FILTER_MAP_NEXT,
expr.span,

View File

@ -96,7 +96,7 @@ pub fn span_lint_and_help<'a, T: LintContext>(cx: &'a T, lint: &'static Lint, sp
/// 10 | forget(&SomeStruct);
/// | ^^^^^^^^^^^
/// ```
pub fn span_note_and_lint<'a, T: LintContext>(
pub fn span_lint_and_note<'a, T: LintContext>(
cx: &'a T,
lint: &'static Lint,
span: Span,

View File

@ -318,7 +318,7 @@ impl CompilerLintFunctions {
map.insert("span_lint", "utils::span_lint");
map.insert("struct_span_lint", "utils::span_lint");
map.insert("lint", "utils::span_lint");
map.insert("span_lint_note", "utils::span_note_and_lint");
map.insert("span_lint_note", "utils::span_lint_and_note");
map.insert("span_lint_help", "utils::span_lint_and_help");
Self { map }
}