From 8f7a17e0f48e3586fae619be08351c6761b07596 Mon Sep 17 00:00:00 2001 From: Greg Brown Date: Tue, 19 Jan 2021 22:37:35 +0000 Subject: Remove usage of `extra-traits` feature of syn. --- src/nibble/convert.rs | 16 ++++++++-------- src/nibble/cst.rs | 24 ++++++++++++------------ 2 files changed, 20 insertions(+), 20 deletions(-) (limited to 'src/nibble') diff --git a/src/nibble/convert.rs b/src/nibble/convert.rs index e3c8bfc..f7c20be 100644 --- a/src/nibble/convert.rs +++ b/src/nibble/convert.rs @@ -206,25 +206,25 @@ impl Convert for Cat { let mut iter = self.0.into_pairs(); let (first, punct) = match iter.next().unwrap() { - Pair::Punctuated(t, p) => (t.convert(context)?, Some(p)), + Pair::Punctuated(t, p) => (t.convert(context)?, Some(p.span)), Pair::End(t) => (t.convert(context)?, None), }; let mut rest = Vec::new(); let (span, _) = iter.try_fold( ( - first.span.and_then(|s| punct.and_then(|p| s.join(p.span))), + first.span.and_then(|s| punct.and_then(|p| s.join(p))), punct, ), |(span, punct), pair| { let (snd, p) = match pair { - Pair::Punctuated(t, p) => (t.convert(context)?, Some(p)), + Pair::Punctuated(t, p) => (t.convert(context)?, Some(p.span)), Pair::End(t) => (t.convert(context)?, None), }; let span = span .and_then(|s| snd.span.and_then(|t| s.join(t))) - .and_then(|s| p.and_then(|p| s.join(p.span))); + .and_then(|s| p.and_then(|p| s.join(p))); rest.push((punct, snd)); Ok((span, p)) }, @@ -268,25 +268,25 @@ impl Convert for Alt { let mut iter = self.0.into_pairs(); let (first, punct) = match iter.next().unwrap() { - Pair::Punctuated(t, p) => (t.convert(context)?, Some(p)), + Pair::Punctuated(t, p) => (t.convert(context)?, Some(p.span)), Pair::End(t) => (t.convert(context)?, None), }; let mut rest = Vec::new(); let (span, _) = iter.try_fold( ( - first.span.and_then(|s| punct.and_then(|p| s.join(p.span))), + first.span.and_then(|s| punct.and_then(|p| s.join(p))), punct, ), |(span, punct), pair| { let (snd, p) = match pair { - Pair::Punctuated(t, p) => (t.convert(context)?, Some(p)), + Pair::Punctuated(t, p) => (t.convert(context)?, Some(p.span)), Pair::End(t) => (t.convert(context)?, None), }; let span = span .and_then(|s| snd.span.and_then(|t| s.join(t))) - .and_then(|s| p.and_then(|p| s.join(p.span))); + .and_then(|s| p.and_then(|p| s.join(p))); rest.push((punct, snd)); Ok((span, p)) }, diff --git a/src/nibble/cst.rs b/src/nibble/cst.rs index 2fcc99f..fc698e8 100644 --- a/src/nibble/cst.rs +++ b/src/nibble/cst.rs @@ -19,7 +19,7 @@ pub type Ident = syn::Ident; pub type Literal = LitStr; -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone)] pub struct ArgList { paren_token: Paren, args: Punctuated, @@ -58,7 +58,7 @@ impl Parse for ArgList { } } -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone)] pub struct Call { pub name: Ident, pub args: ArgList, @@ -78,7 +78,7 @@ impl Parse for Call { } } -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone)] pub struct Fix { bracket_token: Bracket, pub arg: Ident, @@ -109,7 +109,7 @@ impl Parse for Fix { } } -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone)] pub struct ParenExpression { paren_token: Paren, pub expr: Expression, @@ -124,7 +124,7 @@ impl Parse for ParenExpression { } } -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone)] pub enum Term { Epsilon(Epsilon), Ident(Ident), @@ -173,7 +173,7 @@ impl Parse for Term { } } -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone)] pub struct Cat(pub Punctuated); impl Parse for Cat { @@ -200,7 +200,7 @@ impl Cat { } } -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone)] pub struct Label { colon_tok: Token![:], pub label: Ident, @@ -220,7 +220,7 @@ impl Parse for Label { } } -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone)] pub struct Labelled { pub cat: Cat, pub label: Option