Skip to content

Commit e98487d

Browse files
Move concat macro path into clippy_utils::paths
1 parent 9202998 commit e98487d

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
@@ -129,6 +129,7 @@ path_macros! {
129129
// Paths in `core`/`alloc`/`std`. This should be avoided and cleaned up by adding diagnostic items.
130130
pub static ALIGN_OF: PathLookup = value_path!(core::mem::align_of);
131131
pub static CHAR_TO_DIGIT: PathLookup = value_path!(char::to_digit);
132+
pub static CONCAT: PathLookup = value_path!(core::macros::builtin::concat);
132133
pub static IO_ERROR_NEW: PathLookup = value_path!(std::io::Error::new);
133134
pub static IO_ERRORKIND_OTHER_CTOR: PathLookup = value_path!(std::io::ErrorKind::Other);
134135
pub static ITER_STEP: PathLookup = type_path!(core::iter::Step);

0 commit comments

Comments
 (0)