Skip to content

Commit

Permalink
Source and From attributes only have single-ident path
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Oct 19, 2023
1 parent 7cec716 commit ff0a0a5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions impl/src/prop.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
use crate::ast::{Enum, Field, Struct, Variant};
use crate::span::MemberSpan;
use proc_macro2::Span;
use syn::spanned::Spanned;
use syn::{Member, Type};

impl Struct<'_> {
Expand Down Expand Up @@ -76,9 +75,9 @@ impl Field<'_> {

pub(crate) fn source_span(&self) -> Span {
if let Some(source_attr) = &self.attrs.source {
source_attr.path().span()
source_attr.path().get_ident().unwrap().span()
} else if let Some(from_attr) = &self.attrs.from {
from_attr.path().span()
from_attr.path().get_ident().unwrap().span()
} else {
self.member.member_span()
}
Expand Down

0 comments on commit ff0a0a5

Please sign in to comment.