diff options
| -rw-r--r-- | clippy_lints/src/useless_concat.rs | 3 | ||||
| -rw-r--r-- | clippy_utils/src/paths.rs | 1 |
2 files changed, 3 insertions, 1 deletions
diff --git a/clippy_lints/src/useless_concat.rs b/clippy_lints/src/useless_concat.rs index 3f68b93d4f5..4a818532f17 100644 --- a/clippy_lints/src/useless_concat.rs +++ b/clippy_lints/src/useless_concat.rs @@ -1,5 +1,6 @@ use clippy_utils::diagnostics::span_lint_and_sugg; use clippy_utils::macros::macro_backtrace; +use clippy_utils::paths::CONCAT; use clippy_utils::source::snippet_opt; use clippy_utils::{match_def_path, tokenize_with_text}; use rustc_ast::LitKind; @@ -42,7 +43,7 @@ impl LateLintPass<'_> for UselessConcat { // Get the direct parent of the expression. && let Some(macro_call) = macro_backtrace(expr.span).next() // Check if the `concat` macro from the `core` library. - && match_def_path(cx, macro_call.def_id, &["core", "macros", "builtin", "concat"]) + && match_def_path(cx, macro_call.def_id, &CONCAT) // We get the original code to parse it. && let Some(original_code) = snippet_opt(cx, macro_call.span) // This check allows us to ensure that the code snippet: diff --git a/clippy_utils/src/paths.rs b/clippy_utils/src/paths.rs index e5179e479cc..9c909033447 100644 --- a/clippy_utils/src/paths.rs +++ b/clippy_utils/src/paths.rs @@ -129,6 +129,7 @@ path_macros! { // Paths in `core`/`alloc`/`std`. This should be avoided and cleaned up by adding diagnostic items. pub static ALIGN_OF: PathLookup = value_path!(core::mem::align_of); pub static CHAR_TO_DIGIT: PathLookup = value_path!(char::to_digit); +pub static CONCAT: PathLookup = value_path!(core::macros::builtin::concat); pub static IO_ERROR_NEW: PathLookup = value_path!(std::io::Error::new); pub static IO_ERRORKIND_OTHER_CTOR: PathLookup = value_path!(std::io::ErrorKind::Other); pub static ITER_STEP: PathLookup = type_path!(core::iter::Step); |
