Skip to content

Commit

Permalink
Add note to the docs on is_from_proc_macro
Browse files Browse the repository at this point in the history
  • Loading branch information
Jarcho committed Jul 2, 2022
1 parent b33cc09 commit bc25171
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion clippy_utils/src/check_proc_macro.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit bc25171

Please sign in to comment.