about summary refs log tree commit diff
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2022-09-13 12:29:26 +0000
committerbors <bors@rust-lang.org>2022-09-13 12:29:26 +0000
commitd574216f2f8d4529df0a0905f1d04da58629e1ca (patch)
tree9af8b975637880a29396788a0234766cf6497a39
parent7b8c4a9e832b8a2b9717cd0b26382f5ccb217c5a (diff)
parentcea10f74b7ee0119a1cd281c3f432b6e4df4f699 (diff)
downloadrust-d574216f2f8d4529df0a0905f1d04da58629e1ca.tar.gz
rust-d574216f2f8d4529df0a0905f1d04da58629e1ca.zip
Auto merge of #9452 - kraktus:doc, r=flip1995
Fix dev book

fix `implements_trait` and `in_external_macro` import path

Remove example using `match_trait_method` since its deprecated.

changelog: none
-rw-r--r--book/src/development/common_tools_writing_lints.md15
1 files changed, 5 insertions, 10 deletions
diff --git a/book/src/development/common_tools_writing_lints.md b/book/src/development/common_tools_writing_lints.md
index 2bc275ceff0..e0c3e664b3d 100644
--- a/book/src/development/common_tools_writing_lints.md
+++ b/book/src/development/common_tools_writing_lints.md
@@ -123,7 +123,8 @@ There are three ways to do this, depending on if the target trait has a
 diagnostic item, lang item or neither.
 
 ```rust
-use clippy_utils::{implements_trait, is_trait_method, match_trait_method, paths};
+use clippy_utils::ty::implements_trait;
+use clippy_utils::is_trait_method;
 use rustc_span::symbol::sym;
 
 impl LateLintPass<'_> for MyStructLint {
@@ -143,13 +144,6 @@ impl LateLintPass<'_> for MyStructLint {
             .map_or(false, |id| implements_trait(cx, ty, id, &[])) {
                 // `expr` implements `Drop` trait
             }
-
-        // 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
-        }
     }
 }
 ```
@@ -233,8 +227,9 @@ functions to deal with macros:
   crates
 
   ```rust
-  #[macro_use]
-  extern crate a_crate_with_macros;
+ use rustc_middle::lint::in_external_macro;
+
+ use a_crate_with_macros::foo;
 
   // `foo` is defined in `a_crate_with_macros`
   foo!("bar");