Skip to content

Commit 1b635c0

Browse files
Move concat macro path into clippy_utils::paths
1 parent f7d8299 commit 1b635c0

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

clippy_lints/src/useless_concat.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use clippy_utils::diagnostics::span_lint_and_sugg;
22
use clippy_utils::macros::macro_backtrace;
3+
use clippy_utils::paths::CONCAT;
34
use clippy_utils::source::snippet_opt;
45
use clippy_utils::{match_def_path, tokenize_with_text};
56
use rustc_ast::LitKind;
@@ -42,7 +43,7 @@ impl LateLintPass<'_> for UselessConcat {
4243
// Get the direct parent of the expression.
4344
&& let Some(macro_call) = macro_backtrace(expr.span).next()
4445
// Check if the `concat` macro from the `core` library.
45-
&& match_def_path(cx, macro_call.def_id, &["core", "macros", "builtin", "concat"])
46+
&& match_def_path(cx, macro_call.def_id, &CONCAT)
4647
// We get the original code to parse it.
4748
&& let Some(original_code) = snippet_opt(cx, macro_call.span)
4849
// This check allows us to ensure that the code snippet:

clippy_utils/src/paths.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ pub const CHILD: [&str; 3] = ["std", "process", "Child"];
3434
pub const CHILD_ID: [&str; 4] = ["std", "process", "Child", "id"];
3535
pub const CHILD_KILL: [&str; 4] = ["std", "process", "Child", "kill"];
3636
pub const PANIC_ANY: [&str; 3] = ["std", "panic", "panic_any"];
37+
pub const CONCAT: [&str; 4] = ["core", "macros", "builtin", "concat"];
3738

3839
// Paths in clippy itself
3940
pub const MSRV: [&str; 3] = ["clippy_utils", "msrvs", "Msrv"];

0 commit comments

Comments
 (0)