Skip to content

Commit 1701c25

Browse files
committed
Fix a lint message
1 parent 868e7d4 commit 1701c25

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

clippy_lints/src/loops.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use crate::utils::usage::{is_unused, mutated_variables};
55
use crate::utils::{
66
get_enclosing_block, get_parent_expr, get_trait_def_id, has_iter_method, higher, implements_trait,
77
is_integer_const, is_no_std_crate, is_refutable, last_path_segment, match_trait_method, match_type, match_var,
8-
multispan_sugg, snippet, snippet_opt, snippet_with_applicability, span_lint, span_lint_and_help,
8+
multispan_sugg, snippet, snippet_opt, snippet_with_applicability, snippet_with_macro_callsite, span_lint, span_lint_and_help,
99
span_lint_and_sugg, span_lint_and_then, SpanlessEq,
1010
};
1111
use crate::utils::{is_type_diagnostic_item, qpath_res, sugg};
@@ -1263,8 +1263,8 @@ fn detect_same_item_push<'tcx>(
12631263
walk_expr(&mut for_pat_visitor, pushed_item);
12641264

12651265
if !for_pat_visitor.found_pattern {
1266-
let vec_str = snippet(cx, vec.span, "");
1267-
let item_str = snippet(cx, pushed_item.span, "");
1266+
let vec_str = snippet_with_macro_callsite(cx, vec.span, "");
1267+
let item_str = snippet_with_macro_callsite(cx, pushed_item.span, "");
12681268

12691269
span_lint_and_help(
12701270
cx,

tests/ui/same_item_push.stderr

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ LL | spaces.push(vec![b' ']);
55
| ^^^^^^
66
|
77
= note: `-D clippy::same-item-push` implied by `-D warnings`
8-
= help: try using vec![<[_]>::into_vec(box [$($x),+]);SIZE] or spaces.resize(NEW_SIZE, <[_]>::into_vec(box [$($x),+]))
8+
= help: try using vec![vec![b' '];SIZE] or spaces.resize(NEW_SIZE, vec![b' '])
99

1010
error: it looks like the same item is being pushed into this Vec
1111
--> $DIR/same_item_push.rs:22:9

0 commit comments

Comments
 (0)