Skip to content

Commit

Permalink
attributes: remove ErrorModes, improve wording on doc
Browse files Browse the repository at this point in the history
  • Loading branch information
ciuncan committed Oct 14, 2021
1 parent 5768a50 commit a5316c7
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions tracing-attributes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,9 @@ use syn::{
/// }
/// ```
///
/// The above example will be emitting error events using the `std::fmt::Display` implementation.
/// If `E` implements `std::fmt::Debug`, you can also make it use that implementation with
/// `err(Debug)`:
/// By default, error values will be recorded using their `std::fmt::Display` implementations.
/// If an error implements `std::fmt::Debug`, it can be recorded using its `Debug` implementation
/// instead, by writing `err(Debug)`:
///
/// ```
/// # use tracing_attributes::instrument;
Expand Down Expand Up @@ -744,7 +744,8 @@ impl Parse for InstrumentArgs {
}
args.fields = Some(input.parse()?);
} else if lookahead.peek(kw::err) {
let ErrorModes(mode) = input.parse()?;
let _ = input.parse::<kw::err>();
let mode = ErrorMode::parse(input)?;
args.err_mode = Some(mode);
} else if lookahead.peek(Token![,]) {
let _ = input.parse::<Token![,]>()?;
Expand Down Expand Up @@ -837,17 +838,6 @@ impl Parse for ErrorMode {
}
}

struct ErrorModes(ErrorMode);

impl Parse for ErrorModes {

fn parse(input: ParseStream<'_>) -> syn::Result<Self> {
let _ = input.parse::<kw::err>();
let mode = ErrorMode::parse(input)?;
Ok(Self(mode))
}
}

#[derive(Debug)]
struct Fields(Punctuated<Field, Token![,]>);

Expand Down

0 comments on commit a5316c7

Please sign in to comment.