From 540515220d849de13f75df868d0b653e2002e59a Mon Sep 17 00:00:00 2001 From: xFrednet Date: Thu, 4 Nov 2021 13:27:08 +0100 Subject: [PATCH] Added note about the usage of `clippy_utils::path` --- doc/common_tools_writing_lints.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/common_tools_writing_lints.md b/doc/common_tools_writing_lints.md index 3390e60297c8..552b9b2587b8 100644 --- a/doc/common_tools_writing_lints.md +++ b/doc/common_tools_writing_lints.md @@ -105,6 +105,7 @@ impl LateLintPass<'_> for MyStructLint { } // 3. Using the type path + // This method should be avoided if possible if match_def_path(cx, def_id, &paths::RESULT) { // The type is a `core::result::Result` } @@ -142,6 +143,7 @@ impl LateLintPass<'_> for MyStructLint { // 3. Using the type path with the expression // we use `match_trait_method` function from Clippy's utils + // (This method should be avoided if possible) if match_trait_method(cx, expr, &paths::INTO) { // `expr` implements `Into` trait }