From f5e86d68947c453c064436f892a0d00936e50fa3 Mon Sep 17 00:00:00 2001 From: Yuki Okushi Date: Mon, 27 Jan 2020 11:26:42 +0900 Subject: [PATCH] Rename `span_note_and_lint` to `span_lint_and_note` --- clippy_lints/src/copies.rs | 8 ++++---- clippy_lints/src/copy_iterator.rs | 4 ++-- clippy_lints/src/drop_forget_ref.rs | 6 +++--- clippy_lints/src/eval_order_dependence.rs | 4 ++-- clippy_lints/src/formatting.rs | 10 +++++----- clippy_lints/src/matches.rs | 6 +++--- clippy_lints/src/methods/mod.rs | 10 +++++----- clippy_lints/src/utils/diagnostics.rs | 2 +- clippy_lints/src/utils/internal_lints.rs | 2 +- 9 files changed, 26 insertions(+), 26 deletions(-) diff --git a/clippy_lints/src/copies.rs b/clippy_lints/src/copies.rs index 0cf8d32d2d0..d2d20375daf 100644 --- a/clippy_lints/src/copies.rs +++ b/clippy_lints/src/copies.rs @@ -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, diff --git a/clippy_lints/src/copy_iterator.rs b/clippy_lints/src/copy_iterator.rs index 720ff6bac9a..3e2d5b88e7b 100644 --- a/clippy_lints/src/copy_iterator.rs +++ b/clippy_lints/src/copy_iterator.rs @@ -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, diff --git a/clippy_lints/src/drop_forget_ref.rs b/clippy_lints/src/drop_forget_ref.rs index d9ce102314b..29351deea28 100644 --- a/clippy_lints/src/drop_forget_ref.rs +++ b/clippy_lints/src/drop_forget_ref.rs @@ -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, diff --git a/clippy_lints/src/eval_order_dependence.rs b/clippy_lints/src/eval_order_dependence.rs index 8f52f0e3d86..f143c7462ad 100644 --- a/clippy_lints/src/eval_order_dependence.rs +++ b/clippy_lints/src/eval_order_dependence.rs @@ -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, diff --git a/clippy_lints/src/formatting.rs b/clippy_lints/src/formatting.rs index b5f98cb92e6..31e924e36ab 100644 --- a/clippy_lints/src/formatting.rs +++ b/clippy_lints/src/formatting.rs @@ -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, diff --git a/clippy_lints/src/matches.rs b/clippy_lints/src/matches.rs index 119a47a6b8c..0fc7799c97a 100644 --- a/clippy_lints/src/matches.rs +++ b/clippy_lints/src/matches.rs @@ -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), diff --git a/clippy_lints/src/methods/mod.rs b/clippy_lints/src/methods/mod.rs index c15ef05c3a4..d00d8dfbd3e 100644 --- a/clippy_lints/src/methods/mod.rs +++ b/clippy_lints/src/methods/mod.rs @@ -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, diff --git a/clippy_lints/src/utils/diagnostics.rs b/clippy_lints/src/utils/diagnostics.rs index 04f2481851f..9739b118f74 100644 --- a/clippy_lints/src/utils/diagnostics.rs +++ b/clippy_lints/src/utils/diagnostics.rs @@ -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, diff --git a/clippy_lints/src/utils/internal_lints.rs b/clippy_lints/src/utils/internal_lints.rs index ee18f1fb543..af07cf66658 100644 --- a/clippy_lints/src/utils/internal_lints.rs +++ b/clippy_lints/src/utils/internal_lints.rs @@ -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 } }