Skip to content

Commit

Permalink
Eliminate unneeded use of Spanned trait on single tokens
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Mar 13, 2023
1 parent f729af9 commit 490dc01
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions impl/src/expand.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,15 +528,15 @@ fn type_parameter_of_option(ty: &Type) -> Option<&Type> {

fn spanned_error_trait(input: &DeriveInput) -> TokenStream {
let vis_span = match &input.vis {
Visibility::Public(vis) => Some(vis.pub_token.span()),
Visibility::Crate(vis) => Some(vis.crate_token.span()),
Visibility::Restricted(vis) => Some(vis.pub_token.span()),
Visibility::Public(vis) => Some(vis.pub_token.span),
Visibility::Crate(vis) => Some(vis.crate_token.span),
Visibility::Restricted(vis) => Some(vis.pub_token.span),
Visibility::Inherited => None,
};
let data_span = match &input.data {
Data::Struct(data) => data.struct_token.span(),
Data::Enum(data) => data.enum_token.span(),
Data::Union(data) => data.union_token.span(),
Data::Struct(data) => data.struct_token.span,
Data::Enum(data) => data.enum_token.span,
Data::Union(data) => data.union_token.span,
};
let first_span = vis_span.unwrap_or(data_span);
let last_span = input.ident.span();
Expand Down

0 comments on commit 490dc01

Please sign in to comment.