@@ -36,37 +36,37 @@ lex_enum!(
3636/// A parenthesized expression.
3737#[ derive( Debug , PartialEq , Eq , Clone , Hash , Serialize ) ]
3838#[ serde( transparent) ]
39- pub struct ParenthesizedExpr < ' s > {
39+ pub struct ParenthesizedExpr {
4040 /// The inner expression.
41- pub expr : LogicalExpr < ' s > ,
41+ pub expr : LogicalExpr ,
4242}
4343
4444/// LogicalExpr is a either a generic sub-expression
4545/// or a logical conjunction expression.
4646#[ derive( Debug , PartialEq , Eq , Clone , Hash , Serialize ) ]
4747#[ serde( untagged) ]
48- pub enum LogicalExpr < ' s > {
48+ pub enum LogicalExpr {
4949 /// Logical conjunction expression
5050 Combining {
5151 /// Logical operator
5252 op : LogicalOp ,
5353 /// List of sub-expressions
54- items : Vec < LogicalExpr < ' s > > ,
54+ items : Vec < LogicalExpr > ,
5555 } ,
5656 /// A comparison expression.
57- Comparison ( ComparisonExpr < ' s > ) ,
57+ Comparison ( ComparisonExpr ) ,
5858 /// A parenthesized expression.
59- Parenthesized ( Box < ParenthesizedExpr < ' s > > ) ,
59+ Parenthesized ( Box < ParenthesizedExpr > ) ,
6060 /// A unary expression.
6161 Unary {
6262 /// Unary operator.
6363 op : UnaryOp ,
6464 /// Sub-expression.
65- arg : Box < LogicalExpr < ' s > > ,
65+ arg : Box < LogicalExpr > ,
6666 } ,
6767}
6868
69- impl GetType for LogicalExpr < ' _ > {
69+ impl GetType for LogicalExpr {
7070 fn get_type ( & self ) -> Type {
7171 match & self {
7272 LogicalExpr :: Combining { ref items, .. } => items[ 0 ] . get_type ( ) ,
@@ -77,15 +77,15 @@ impl GetType for LogicalExpr<'_> {
7777 }
7878}
7979
80- impl < ' s > LogicalExpr < ' s > {
80+ impl LogicalExpr {
8181 fn lex_combining_op ( input : & str ) -> ( Option < LogicalOp > , & str ) {
8282 match LogicalOp :: lex ( skip_space ( input) ) {
8383 Ok ( ( op, input) ) => ( Some ( op) , skip_space ( input) ) ,
8484 Err ( _) => ( None , input) ,
8585 }
8686 }
8787
88- fn lex_simple_expr < ' i > ( input : & ' i str , parser : & FilterParser < ' s > ) -> LexResult < ' i , Self > {
88+ fn lex_simple_expr < ' i > ( input : & ' i str , parser : & FilterParser < ' _ > ) -> LexResult < ' i , Self > {
8989 Ok ( if let Ok ( input) = expect ( input, "(" ) {
9090 let input = skip_space ( input) ;
9191 let ( expr, input) = LogicalExpr :: lex_with ( input, parser) ?;
@@ -113,7 +113,7 @@ impl<'s> LogicalExpr<'s> {
113113
114114 fn lex_more_with_precedence < ' i > (
115115 self ,
116- parser : & FilterParser < ' s > ,
116+ parser : & FilterParser < ' _ > ,
117117 min_prec : Option < LogicalOp > ,
118118 mut lookahead : ( Option < LogicalOp > , & ' i str ) ,
119119 ) -> LexResult < ' i , Self > {
@@ -177,17 +177,17 @@ impl<'s> LogicalExpr<'s> {
177177 }
178178}
179179
180- impl < ' i , ' s > LexWith < ' i , & FilterParser < ' s > > for LogicalExpr < ' s > {
180+ impl < ' i , ' s > LexWith < ' i , & FilterParser < ' s > > for LogicalExpr {
181181 fn lex_with ( input : & ' i str , parser : & FilterParser < ' s > ) -> LexResult < ' i , Self > {
182182 let ( lhs, input) = Self :: lex_simple_expr ( input, parser) ?;
183183 let lookahead = Self :: lex_combining_op ( input) ;
184184 lhs. lex_more_with_precedence ( parser, None , lookahead)
185185 }
186186}
187187
188- impl < ' s > Expr < ' s > for LogicalExpr < ' s > {
188+ impl Expr for LogicalExpr {
189189 #[ inline]
190- fn walk < ' a , V : Visitor < ' s , ' a > > ( & ' a self , visitor : & mut V ) {
190+ fn walk < ' a , V : Visitor < ' a > > ( & ' a self , visitor : & mut V ) {
191191 match self {
192192 LogicalExpr :: Comparison ( node) => visitor. visit_comparison_expr ( node) ,
193193 LogicalExpr :: Parenthesized ( node) => visitor. visit_logical_expr ( & node. expr ) ,
@@ -201,7 +201,7 @@ impl<'s> Expr<'s> for LogicalExpr<'s> {
201201 }
202202
203203 #[ inline]
204- fn walk_mut < ' a , V : VisitorMut < ' s , ' a > > ( & ' a mut self , visitor : & mut V ) {
204+ fn walk_mut < ' a , V : VisitorMut < ' a > > ( & ' a mut self , visitor : & mut V ) {
205205 match self {
206206 LogicalExpr :: Comparison ( node) => visitor. visit_comparison_expr ( node) ,
207207 LogicalExpr :: Parenthesized ( node) => visitor. visit_logical_expr ( & mut node. expr ) ,
@@ -214,10 +214,7 @@ impl<'s> Expr<'s> for LogicalExpr<'s> {
214214 }
215215 }
216216
217- fn compile_with_compiler < C : Compiler < ' s > + ' s > (
218- self ,
219- compiler : & mut C ,
220- ) -> CompiledExpr < ' s , C :: U > {
217+ fn compile_with_compiler < C : Compiler > ( self , compiler : & mut C ) -> CompiledExpr < C :: U > {
221218 match self {
222219 LogicalExpr :: Comparison ( op) => compiler. compile_comparison_expr ( op) ,
223220 LogicalExpr :: Parenthesized ( node) => compiler. compile_logical_expr ( node. expr ) ,
@@ -603,7 +600,7 @@ fn test() {
603600
604601 {
605602 assert_err ! (
606- FilterParser :: new( scheme) . lex_as:: <LogicalExpr < ' _> >( "t and af" ) ,
603+ FilterParser :: new( scheme) . lex_as:: <LogicalExpr >( "t and af" ) ,
607604 LexErrorKind :: TypeMismatch ( TypeMismatchError {
608605 expected: Type :: Bool . into( ) ,
609606 actual: Type :: Array ( Type :: Bool . into( ) ) ,
@@ -612,7 +609,7 @@ fn test() {
612609 ) ;
613610
614611 assert_err ! (
615- FilterParser :: new( scheme) . lex_as:: <LogicalExpr < ' _> >( "at and f" ) ,
612+ FilterParser :: new( scheme) . lex_as:: <LogicalExpr >( "at and f" ) ,
616613 LexErrorKind :: TypeMismatch ( TypeMismatchError {
617614 expected: Type :: Array ( Type :: Bool . into( ) ) . into( ) ,
618615 actual: Type :: Bool ,
@@ -623,7 +620,7 @@ fn test() {
623620
624621 {
625622 assert_err ! (
626- FilterParser :: new( scheme) . lex_as:: <LogicalExpr < ' _> >( "t or af" ) ,
623+ FilterParser :: new( scheme) . lex_as:: <LogicalExpr >( "t or af" ) ,
627624 LexErrorKind :: TypeMismatch ( TypeMismatchError {
628625 expected: Type :: Bool . into( ) ,
629626 actual: Type :: Array ( Type :: Bool . into( ) ) ,
@@ -632,7 +629,7 @@ fn test() {
632629 ) ;
633630
634631 assert_err ! (
635- FilterParser :: new( scheme) . lex_as:: <LogicalExpr < ' _> >( "at or f" ) ,
632+ FilterParser :: new( scheme) . lex_as:: <LogicalExpr >( "at or f" ) ,
636633 LexErrorKind :: TypeMismatch ( TypeMismatchError {
637634 expected: Type :: Array ( Type :: Bool . into( ) ) . into( ) ,
638635 actual: Type :: Bool ,
@@ -643,7 +640,7 @@ fn test() {
643640
644641 {
645642 assert_err ! (
646- FilterParser :: new( scheme) . lex_as:: <LogicalExpr < ' _> >( "t xor af" ) ,
643+ FilterParser :: new( scheme) . lex_as:: <LogicalExpr >( "t xor af" ) ,
647644 LexErrorKind :: TypeMismatch ( TypeMismatchError {
648645 expected: Type :: Bool . into( ) ,
649646 actual: Type :: Array ( Type :: Bool . into( ) ) ,
@@ -652,7 +649,7 @@ fn test() {
652649 ) ;
653650
654651 assert_err ! (
655- FilterParser :: new( scheme) . lex_as:: <LogicalExpr < ' _> >( "at xor f" ) ,
652+ FilterParser :: new( scheme) . lex_as:: <LogicalExpr >( "at xor f" ) ,
656653 LexErrorKind :: TypeMismatch ( TypeMismatchError {
657654 expected: Type :: Array ( Type :: Bool . into( ) ) . into( ) ,
658655 actual: Type :: Bool ,
@@ -702,7 +699,7 @@ fn test() {
702699 FilterParser :: new( scheme) . lex_as( "at[*]" ) ,
703700 LogicalExpr :: Comparison ( ComparisonExpr {
704701 lhs: IndexExpr {
705- identifier: IdentifierExpr :: Field ( scheme. get_field( "at" ) . unwrap( ) ) ,
702+ identifier: IdentifierExpr :: Field ( scheme. get_field( "at" ) . unwrap( ) . to_owned ( ) ) ,
706703 indexes: vec![ FieldIndex :: MapEach ] ,
707704 } ,
708705 op: ComparisonOpExpr :: IsTrue
@@ -726,7 +723,7 @@ fn test() {
726723
727724 {
728725 assert_err ! (
729- FilterParser :: new( scheme) . lex_as:: <LogicalExpr < ' _> >( "aat[*]" ) ,
726+ FilterParser :: new( scheme) . lex_as:: <LogicalExpr >( "aat[*]" ) ,
730727 LexErrorKind :: UnsupportedOp {
731728 lhs_type: Type :: Array ( Type :: Array ( Type :: Bool . into( ) ) . into( ) )
732729 } ,
0 commit comments