Skip to content

Commit 53c5e21

Browse files
committed
feat: upgrade to syn 2.0
1 parent 387c060 commit 53c5e21

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ description = "Support for trait alias feature on stable Rust."
1616
proc-macro = true
1717

1818
[dependencies]
19-
syn = "1.0"
19+
syn = "2.0"
2020
quote = "1.0"
2121
proc-macro2 = "1.0"
2222

src/lib.rs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ use syn::{
3939
parse_macro_input,
4040
punctuated::Punctuated,
4141
spanned::Spanned,
42-
Attribute, GenericParam, Generics, Ident, Lit, Meta, MetaNameValue, Result, Token,
42+
Attribute, Expr, GenericParam, Generics, Ident, Lit, Meta, MetaNameValue, Result, Token,
4343
TypeTraitObject, Visibility,
4444
};
4545

@@ -64,10 +64,15 @@ impl TraitSet {
6464

6565
for attr in attrs {
6666
// Check whether current attribute is `#[doc = "..."]`.
67-
if let Meta::NameValue(MetaNameValue { path, lit, .. }) = attr.parse_meta()? {
67+
if let Meta::NameValue(MetaNameValue {
68+
path,
69+
value: Expr::Lit(lit),
70+
..
71+
}) = &attr.meta
72+
{
6873
if let Some(path_ident) = path.get_ident() {
6974
if path_ident == "doc" {
70-
if let Lit::Str(doc_comment) = lit {
75+
if let Lit::Str(doc_comment) = &lit.lit {
7176
out += &doc_comment.value();
7277
// Newlines are not included in the literal value,
7378
// so we have to add them manually.
@@ -172,7 +177,7 @@ struct ManyTraitSet {
172177
impl Parse for ManyTraitSet {
173178
fn parse(input: ParseStream) -> Result<Self> {
174179
Ok(ManyTraitSet {
175-
entries: input.parse_terminated(TraitSet::parse)?,
180+
entries: input.parse_terminated(TraitSet::parse, Token![;])?,
176181
})
177182
}
178183
}

0 commit comments

Comments
 (0)