]> git.lizzy.rs Git - rust.git/commitdiff
Add note to the docs on `is_from_proc_macro`
authorJason Newcomb <jsnewcomb@pm.me>
Sun, 24 Apr 2022 14:04:33 +0000 (10:04 -0400)
committerJason Newcomb <jsnewcomb@pm.me>
Mon, 8 Aug 2022 01:55:10 +0000 (21:55 -0400)
clippy_utils/src/check_proc_macro.rs

index f546a788c5d39a6120c5ef1ee4e44fb7b44230f8..9f2c412eb8553299b8eb6889c4bff33f8ade1ac2 100644 (file)
@@ -271,7 +271,10 @@ fn span(&self) -> Span {
 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)