about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTakayuki Nakata <f.seasons017@gmail.com>2020-07-21 08:15:13 +0900
committerTakayuki Nakata <f.seasons017@gmail.com>2020-08-05 22:59:12 +0900
commit14a4e3bcc8082b0323886ae15365ea2424b512cf (patch)
tree14f72a00a521ad295a0c90bba3a133e49e3fe392
parent1543e117cc7459bef2b57389503f0f526a903f45 (diff)
downloadrust-14a4e3bcc8082b0323886ae15365ea2424b512cf.tar.gz
rust-14a4e3bcc8082b0323886ae15365ea2424b512cf.zip
Fix a lint message
-rw-r--r--clippy_lints/src/loops.rs11
-rw-r--r--tests/ui/same_item_push.stderr2
2 files changed, 7 insertions, 6 deletions
diff --git a/clippy_lints/src/loops.rs b/clippy_lints/src/loops.rs
index 766c68df623..8ca67cae0e9 100644
--- a/clippy_lints/src/loops.rs
+++ b/clippy_lints/src/loops.rs
@@ -3,9 +3,10 @@ use crate::utils::paths;
 use crate::utils::sugg::Sugg;
 use crate::utils::usage::{is_unused, mutated_variables};
 use crate::utils::{
-    get_enclosing_block, get_parent_expr, get_trait_def_id, has_iter_method, higher, implements_trait,
-    is_integer_const, is_no_std_crate, is_refutable, is_type_diagnostic_item, last_path_segment, match_trait_method,
-    match_type, match_var, multispan_sugg, qpath_res, snippet, snippet_opt, snippet_with_applicability, span_lint,
+    get_enclosing_block, get_parent_expr, get_trait_def_id, has_iter_method, higher,
+    implements_trait, is_integer_const, is_no_std_crate, is_refutable, is_type_diagnostic_item,
+    last_path_segment, match_trait_method, match_type, match_var, multispan_sugg, qpath_res,
+    snippet, snippet_opt, snippet_with_applicability, snippet_with_macro_callsite, span_lint,
     span_lint_and_help, span_lint_and_sugg, span_lint_and_then, sugg, SpanlessEq,
 };
 use if_chain::if_chain;
@@ -1262,8 +1263,8 @@ fn detect_same_item_push<'tcx>(
                 walk_expr(&mut for_pat_visitor, pushed_item);
 
                 if !for_pat_visitor.found_pattern {
-                    let vec_str = snippet(cx, vec.span, "");
-                    let item_str = snippet(cx, pushed_item.span, "");
+                    let vec_str = snippet_with_macro_callsite(cx, vec.span, "");
+                    let item_str = snippet_with_macro_callsite(cx, pushed_item.span, "");
 
                     span_lint_and_help(
                         cx,
diff --git a/tests/ui/same_item_push.stderr b/tests/ui/same_item_push.stderr
index 559cc450b9d..ddc5d48cd41 100644
--- a/tests/ui/same_item_push.stderr
+++ b/tests/ui/same_item_push.stderr
@@ -5,7 +5,7 @@ LL |         spaces.push(vec![b' ']);
    |         ^^^^^^
    |
    = note: `-D clippy::same-item-push` implied by `-D warnings`
-   = help: try using vec![<[_]>::into_vec(box [$($x),+]);SIZE] or spaces.resize(NEW_SIZE, <[_]>::into_vec(box [$($x),+]))
+   = help: try using vec![vec![b' '];SIZE] or spaces.resize(NEW_SIZE, vec![b' '])
 
 error: it looks like the same item is being pushed into this Vec
   --> $DIR/same_item_push.rs:22:9