From 075d9c97c079143ce2e8ccfe810f9402a35c2623 Mon Sep 17 00:00:00 2001 From: Tamo Date: Sat, 6 Nov 2021 16:02:27 +0100 Subject: [PATCH] re-implement the equality between tokens to only compare the inner value --- filter_parser/src/lib.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/filter_parser/src/lib.rs b/filter_parser/src/lib.rs index d09744196..a1d66819f 100644 --- a/filter_parser/src/lib.rs +++ b/filter_parser/src/lib.rs @@ -60,12 +60,18 @@ pub type Span<'a> = LocatedSpan<&'a str, &'a str>; type IResult<'a, Ret> = nom::IResult, Ret, Error<'a>>; -#[derive(Debug, Clone, PartialEq, Eq)] +#[derive(Debug, Clone, Eq)] pub struct Token<'a> { pub position: Span<'a>, pub inner: &'a str, } +impl<'a> PartialEq for Token<'a> { + fn eq(&self, other: &Self) -> bool { + self.inner == other.inner + } +} + impl<'a> Token<'a> { pub fn new(position: Span<'a>) -> Self { Self { position, inner: &position }