Skip to content

Commit f5e86d6

Browse files
committed
Rename span_note_and_lint to span_lint_and_note
1 parent f60f12f commit f5e86d6

File tree

9 files changed

+26
-26
lines changed

9 files changed

+26
-26
lines changed

Diff for: clippy_lints/src/copies.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::utils::{get_parent_expr, higher, if_sequence, same_tys, snippet, span_lint_and_then, span_note_and_lint};
1+
use crate::utils::{get_parent_expr, higher, if_sequence, same_tys, snippet, span_lint_and_note, span_lint_and_then};
22
use crate::utils::{SpanlessEq, SpanlessHash};
33
use rustc::ty::Ty;
44
use rustc_data_structures::fx::FxHashMap;
@@ -178,7 +178,7 @@ fn lint_same_then_else(cx: &LateContext<'_, '_>, blocks: &[&Block<'_>]) {
178178
&|&lhs, &rhs| -> bool { SpanlessEq::new(cx).eq_block(lhs, rhs) };
179179

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

203203
for (i, j) in search_same(conds, hash, eq) {
204-
span_note_and_lint(
204+
span_lint_and_note(
205205
cx,
206206
IFS_SAME_COND,
207207
j.span,
@@ -229,7 +229,7 @@ fn lint_same_fns_in_if_cond(cx: &LateContext<'_, '_>, conds: &[&Expr<'_>]) {
229229
};
230230

231231
for (i, j) in search_same(conds, hash, eq) {
232-
span_note_and_lint(
232+
span_lint_and_note(
233233
cx,
234234
SAME_FUNCTIONS_IN_IF_CONDITION,
235235
j.span,

Diff for: clippy_lints/src/copy_iterator.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::utils::{is_copy, match_path, paths, span_note_and_lint};
1+
use crate::utils::{is_copy, match_path, paths, span_lint_and_note};
22
use rustc_hir::{Item, ItemKind};
33
use rustc_lint::{LateContext, LateLintPass};
44
use rustc_session::{declare_lint_pass, declare_tool_lint};
@@ -41,7 +41,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for CopyIterator {
4141
let ty = cx.tcx.type_of(cx.tcx.hir().local_def_id(item.hir_id));
4242

4343
if is_copy(cx, ty) && match_path(&trait_ref.path, &paths::ITERATOR) {
44-
span_note_and_lint(
44+
span_lint_and_note(
4545
cx,
4646
COPY_ITERATOR,
4747
item.span,

Diff for: clippy_lints/src/drop_forget_ref.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::utils::{is_copy, match_def_path, paths, qpath_res, span_note_and_lint};
1+
use crate::utils::{is_copy, match_def_path, paths, qpath_res, span_lint_and_note};
22
use if_chain::if_chain;
33
use rustc::ty;
44
use rustc_hir::*;
@@ -131,7 +131,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DropForgetRef {
131131
} else {
132132
return;
133133
}
134-
span_note_and_lint(cx,
134+
span_lint_and_note(cx,
135135
lint,
136136
expr.span,
137137
&msg,
@@ -147,7 +147,7 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for DropForgetRef {
147147
} else {
148148
return;
149149
}
150-
span_note_and_lint(cx,
150+
span_lint_and_note(cx,
151151
lint,
152152
expr.span,
153153
&msg,

Diff for: clippy_lints/src/eval_order_dependence.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::utils::{get_parent_expr, span_lint, span_note_and_lint};
1+
use crate::utils::{get_parent_expr, span_lint, span_lint_and_note};
22
use if_chain::if_chain;
33
use rustc::hir::map::Map;
44
use rustc::ty;
@@ -307,7 +307,7 @@ impl<'a, 'tcx> Visitor<'tcx> for ReadVisitor<'a, 'tcx> {
307307
// Check that this is a read, not a write.
308308
if !is_in_assignment_position(self.cx, expr);
309309
then {
310-
span_note_and_lint(
310+
span_lint_and_note(
311311
self.cx,
312312
EVAL_ORDER_DEPENDENCE,
313313
expr.span,

Diff for: clippy_lints/src/formatting.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use crate::utils::{differing_macro_contexts, snippet_opt, span_lint_and_help, span_note_and_lint};
1+
use crate::utils::{differing_macro_contexts, snippet_opt, span_lint_and_help, span_lint_and_note};
22
use if_chain::if_chain;
33
use rustc::lint::in_external_macro;
44
use rustc_lint::{EarlyContext, EarlyLintPass};
@@ -140,7 +140,7 @@ fn check_assign(cx: &EarlyContext<'_>, expr: &Expr) {
140140
let op = UnOp::to_string(op);
141141
let eqop_span = lhs.span.between(sub_rhs.span);
142142
if eq_snippet.ends_with('=') {
143-
span_note_and_lint(
143+
span_lint_and_note(
144144
cx,
145145
SUSPICIOUS_ASSIGNMENT_FORMATTING,
146146
eqop_span,
@@ -221,7 +221,7 @@ fn check_else(cx: &EarlyContext<'_>, expr: &Expr) {
221221
let else_desc = if is_if(else_) { "if" } else { "{..}" };
222222

223223
then {
224-
span_note_and_lint(
224+
span_lint_and_note(
225225
cx,
226226
SUSPICIOUS_ELSE_FORMATTING,
227227
else_span,
@@ -260,7 +260,7 @@ fn check_array(cx: &EarlyContext<'_>, expr: &Expr) {
260260
if space_snippet.contains('\n');
261261
if indentation(cx, op.span) <= indentation(cx, lhs.span);
262262
then {
263-
span_note_and_lint(
263+
span_lint_and_note(
264264
cx,
265265
POSSIBLE_MISSING_COMMA,
266266
lint_span,
@@ -291,7 +291,7 @@ fn check_missing_else(cx: &EarlyContext<'_>, first: &Expr, second: &Expr) {
291291
("an `else {..}`", "the next block")
292292
};
293293

294-
span_note_and_lint(
294+
span_lint_and_note(
295295
cx,
296296
SUSPICIOUS_ELSE_FORMATTING,
297297
else_span,

Diff for: clippy_lints/src/matches.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use crate::utils::sugg::Sugg;
44
use crate::utils::usage::is_unused;
55
use crate::utils::{
66
expr_block, is_allowed, is_expn_of, is_wild, match_qpath, match_type, multispan_sugg, remove_blocks, snippet,
7-
snippet_with_applicability, span_lint_and_help, span_lint_and_sugg, span_lint_and_then, span_note_and_lint,
7+
snippet_with_applicability, span_lint_and_help, span_lint_and_note, span_lint_and_sugg, span_lint_and_then,
88
walk_ptrs_ty,
99
};
1010
use if_chain::if_chain;
@@ -449,7 +449,7 @@ fn check_overlapping_arms<'a, 'tcx>(cx: &LateContext<'a, 'tcx>, ex: &'tcx Expr<'
449449
let type_ranges = type_ranges(&ranges);
450450
if !type_ranges.is_empty() {
451451
if let Some((start, end)) = overlapping(&type_ranges) {
452-
span_note_and_lint(
452+
span_lint_and_note(
453453
cx,
454454
MATCH_OVERLAPPING_ARM,
455455
start.span,
@@ -488,7 +488,7 @@ fn check_wild_err_arm(cx: &LateContext<'_, '_>, ex: &Expr<'_>, arms: &[Arm<'_>])
488488
if is_panic_block(block);
489489
then {
490490
// `Err(_)` or `Err(_e)` arm with `panic!` found
491-
span_note_and_lint(cx,
491+
span_lint_and_note(cx,
492492
MATCH_WILD_ERR_ARM,
493493
arm.pat.span,
494494
&format!("`Err({})` matches all errors", &ident_bind_name),

Diff for: clippy_lints/src/methods/mod.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ use crate::utils::{
2828
is_ctor_or_promotable_const_function, is_expn_of, is_type_diagnostic_item, iter_input_pats, last_path_segment,
2929
match_def_path, match_qpath, match_trait_method, match_type, match_var, method_calls, method_chain_args, paths,
3030
remove_blocks, return_ty, same_tys, single_segment_path, snippet, snippet_with_applicability,
31-
snippet_with_macro_callsite, span_lint, span_lint_and_help, span_lint_and_sugg, span_lint_and_then,
32-
span_note_and_lint, sugg, walk_ptrs_ty, walk_ptrs_ty_depth, SpanlessEq,
31+
snippet_with_macro_callsite, span_lint, span_lint_and_help, span_lint_and_note, span_lint_and_sugg,
32+
span_lint_and_then, sugg, walk_ptrs_ty, walk_ptrs_ty_depth, SpanlessEq,
3333
};
3434

3535
declare_clippy_lint! {
@@ -2422,7 +2422,7 @@ fn lint_map_unwrap_or_else<'a, 'tcx>(
24222422
let multiline = map_snippet.lines().count() > 1 || unwrap_snippet.lines().count() > 1;
24232423
let same_span = map_args[1].span.ctxt() == unwrap_args[1].span.ctxt();
24242424
if same_span && !multiline {
2425-
span_note_and_lint(
2425+
span_lint_and_note(
24262426
cx,
24272427
if is_option {
24282428
OPTION_MAP_UNWRAP_OR_ELSE
@@ -2566,7 +2566,7 @@ fn lint_filter_next<'a, 'tcx>(
25662566
let filter_snippet = snippet(cx, filter_args[1].span, "..");
25672567
if filter_snippet.lines().count() <= 1 {
25682568
// add note if not multi-line
2569-
span_note_and_lint(
2569+
span_lint_and_note(
25702570
cx,
25712571
FILTER_NEXT,
25722572
expr.span,
@@ -2624,7 +2624,7 @@ fn lint_filter_map_next<'a, 'tcx>(
26242624
`.find_map(p)` instead.";
26252625
let filter_snippet = snippet(cx, filter_args[1].span, "..");
26262626
if filter_snippet.lines().count() <= 1 {
2627-
span_note_and_lint(
2627+
span_lint_and_note(
26282628
cx,
26292629
FILTER_MAP_NEXT,
26302630
expr.span,

Diff for: clippy_lints/src/utils/diagnostics.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub fn span_lint_and_help<'a, T: LintContext>(cx: &'a T, lint: &'static Lint, sp
9696
/// 10 | forget(&SomeStruct);
9797
/// | ^^^^^^^^^^^
9898
/// ```
99-
pub fn span_note_and_lint<'a, T: LintContext>(
99+
pub fn span_lint_and_note<'a, T: LintContext>(
100100
cx: &'a T,
101101
lint: &'static Lint,
102102
span: Span,

Diff for: clippy_lints/src/utils/internal_lints.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ impl CompilerLintFunctions {
318318
map.insert("span_lint", "utils::span_lint");
319319
map.insert("struct_span_lint", "utils::span_lint");
320320
map.insert("lint", "utils::span_lint");
321-
map.insert("span_lint_note", "utils::span_note_and_lint");
321+
map.insert("span_lint_note", "utils::span_lint_and_note");
322322
map.insert("span_lint_help", "utils::span_lint_and_help");
323323
Self { map }
324324
}

0 commit comments

Comments
 (0)