diff options
author | Greg Brown <gmb60@cam.ac.uk> | 2021-01-19 22:37:35 +0000 |
---|---|---|
committer | Greg Brown <gmb60@cam.ac.uk> | 2021-01-19 22:38:45 +0000 |
commit | 8f7a17e0f48e3586fae619be08351c6761b07596 (patch) | |
tree | 0fe2c78b93cdfcbe7b6621c272c8b73eacfc53c4 /src/nibble | |
parent | f6916209d57682493288ab42e695204b95d0ba23 (diff) |
Remove usage of `extra-traits` feature of syn.
Diffstat (limited to 'src/nibble')
-rw-r--r-- | src/nibble/convert.rs | 16 | ||||
-rw-r--r-- | src/nibble/cst.rs | 24 |
2 files changed, 20 insertions, 20 deletions
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<T> { paren_token: Paren, args: Punctuated<T, Comma>, @@ -58,7 +58,7 @@ impl<T: Parse> Parse for ArgList<T> { } } -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone)] pub struct Call { pub name: Ident, pub args: ArgList<Expression>, @@ -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<Term, Token![.]>); 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<Label>, @@ -248,7 +248,7 @@ impl Parse for Labelled { } } -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone)] pub struct Alt(pub Punctuated<Labelled, Token![|]>); impl Parse for Alt { @@ -259,7 +259,7 @@ impl Parse for Alt { pub type Expression = Alt; -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone)] pub struct LetStatement { let_token: Token![let], name: Ident, @@ -299,7 +299,7 @@ impl Parse for LetStatement { } } -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone)] pub struct GoalStatement { match_token: Token![match], expr: Expression, @@ -320,7 +320,7 @@ impl Parse for GoalStatement { } } -#[derive(Clone, Debug, Eq, PartialEq)] +#[derive(Clone)] pub struct File { lets: Vec<LetStatement>, goal: GoalStatement, |