Skip to content

Commit

Permalink
improve comments
Browse files Browse the repository at this point in the history
  • Loading branch information
cynecx committed Oct 15, 2021
1 parent b8a5ab6 commit 9cf4bd5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tracing-attributes/src/lib.rs
Expand Up @@ -650,7 +650,7 @@ fn gen_block<B: ToTokens>(
}

/// This is a more flexible/imprecise `ItemFn` type,
/// which's block may be anything that implements `ToTokens`.
/// which's block is just a `TokenStream` (it may contain invalid code).
#[derive(Debug, Clone)]
struct MaybeItemFn {
attrs: Vec<Attribute>,
Expand All @@ -670,7 +670,7 @@ impl MaybeItemFn {
}
}

/// This parses a TokenStream as ItemFn/MaybeItemFn but skips the body.
/// This parses a TokenStream into a MaybeItemFn(just like ItemFn, but skips the body).
impl Parse for MaybeItemFn {
fn parse(input: ParseStream<'_>) -> syn::Result<Self> {
let attrs = input.call(syn::Attribute::parse_outer)?;
Expand All @@ -686,7 +686,8 @@ impl Parse for MaybeItemFn {
}
}

/// A generic reference type for `MaybeItemFn`.
/// A generic reference type for `MaybeItemFn`,
/// that takes a generic block type `B` that implements `ToTokens` (eg. `TokenStream`, `Block`).
#[derive(Debug, Clone)]
struct MaybeItemFnRef<'a, B: ToTokens> {
attrs: &'a Vec<Attribute>,
Expand Down

0 comments on commit 9cf4bd5

Please sign in to comment.