Skip to content

Commit d574216

Browse files
committed
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
2 parents 7b8c4a9 + cea10f7 commit d574216

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

book/src/development/common_tools_writing_lints.md

+5-10
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,8 @@ There are three ways to do this, depending on if the target trait has a
123123
diagnostic item, lang item or neither.
124124

125125
```rust
126-
use clippy_utils::{implements_trait, is_trait_method, match_trait_method, paths};
126+
use clippy_utils::ty::implements_trait;
127+
use clippy_utils::is_trait_method;
127128
use rustc_span::symbol::sym;
128129

129130
impl LateLintPass<'_> for MyStructLint {
@@ -143,13 +144,6 @@ impl LateLintPass<'_> for MyStructLint {
143144
.map_or(false, |id| implements_trait(cx, ty, id, &[])) {
144145
// `expr` implements `Drop` trait
145146
}
146-
147-
// 3. Using the type path with the expression
148-
// we use `match_trait_method` function from Clippy's utils
149-
// (This method should be avoided if possible)
150-
if match_trait_method(cx, expr, &paths::INTO) {
151-
// `expr` implements `Into` trait
152-
}
153147
}
154148
}
155149
```
@@ -233,8 +227,9 @@ functions to deal with macros:
233227
crates
234228

235229
```rust
236-
#[macro_use]
237-
extern crate a_crate_with_macros;
230+
use rustc_middle::lint::in_external_macro;
231+
232+
use a_crate_with_macros::foo;
238233

239234
// `foo` is defined in `a_crate_with_macros`
240235
foo!("bar");

0 commit comments

Comments
 (0)