diff options
| author | Jason Newcomb <jsnewcomb@pm.me> | 2022-04-24 10:04:33 -0400 |
|---|---|---|
| committer | Jason Newcomb <jsnewcomb@pm.me> | 2022-08-07 21:55:10 -0400 |
| commit | 8dda974a2753c0cf4d552e6054303376bc62c7bb (patch) | |
| tree | 74d3e4a36bad874bf7a680ed9bf06a971b03edb2 | |
| parent | 670efd5720b31e235c8e97f49f612e685db97b93 (diff) | |
| download | rust-8dda974a2753c0cf4d552e6054303376bc62c7bb.tar.gz rust-8dda974a2753c0cf4d552e6054303376bc62c7bb.zip | |
Add note to the docs on `is_from_proc_macro`
| -rw-r--r-- | clippy_utils/src/check_proc_macro.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/clippy_utils/src/check_proc_macro.rs b/clippy_utils/src/check_proc_macro.rs index f546a788c5d..9f2c412eb85 100644 --- a/clippy_utils/src/check_proc_macro.rs +++ b/clippy_utils/src/check_proc_macro.rs @@ -271,7 +271,10 @@ impl_with_search_pat!(LateContext: ImplItem with impl_item_search_pat); impl_with_search_pat!(LateContext: FieldDef with field_def_search_pat); impl_with_search_pat!(LateContext: Variant with variant_search_pat); -/// Checks if the item likely came from a proc-macro +/// Checks if the item likely came from a proc-macro. +/// +/// This should be called after `in_external_macro` and the initial pattern matching of the ast as +/// it is significantly slower than both of those. pub fn is_from_proc_macro<T: WithSearchPat>(cx: &T::Context, item: &T) -> bool { let (start_pat, end_pat) = item.search_pat(cx); !span_matches_pat(cx.sess(), item.span(), start_pat, end_pat) |
