diff --git a/rustemo-compiler/src/generator/actions/production.rs b/rustemo-compiler/src/generator/actions/production.rs index 4f4f1b51..6b39ddbf 100644 --- a/rustemo-compiler/src/generator/actions/production.rs +++ b/rustemo-compiler/src/generator/actions/production.rs @@ -145,7 +145,7 @@ impl<'t> ProductionActionsGenerator<'t> { } } -impl<'t> ActionsGenerator for ProductionActionsGenerator<'t> { +impl ActionsGenerator for ProductionActionsGenerator<'_> { fn nonterminal_types(&self, nonterminal: &NonTerminal) -> Vec { let ty = self .types diff --git a/rustemo-compiler/src/table/mod.rs b/rustemo-compiler/src/table/mod.rs index ddbab5f4..ad15eedd 100644 --- a/rustemo-compiler/src/table/mod.rs +++ b/rustemo-compiler/src/table/mod.rs @@ -102,7 +102,7 @@ pub struct LRState<'g> { } /// Two LR states are equal if they contain the same kernel items. -impl<'g> PartialEq for LRState<'g> { +impl PartialEq for LRState<'_> { fn eq(&self, other: &Self) -> bool { let self_ki = self.kernel_items(); let other_ki = other.kernel_items(); @@ -110,9 +110,9 @@ impl<'g> PartialEq for LRState<'g> { && self_ki.iter().zip(other_ki.iter()).all(|(x, y)| x == y) } } -impl<'g> Eq for LRState<'g> {} +impl Eq for LRState<'_> {} -impl<'g> Display for LRState<'g> { +impl Display for LRState<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, @@ -133,7 +133,7 @@ impl<'g> Display for LRState<'g> { } } -impl<'g> std::fmt::Debug for LRState<'g> { +impl std::fmt::Debug for LRState<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("LRState") .field("idx", &self.idx) @@ -467,7 +467,7 @@ pub struct Conflict<'g, 's> { kind: ConflictKind, } -impl<'g, 's> Display for Conflict<'g, 's> { +impl Display for Conflict<'_, '_> { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "")?; Ok(()) @@ -1314,7 +1314,7 @@ fn production_rn_lengths( prod_rn_lens } -impl<'g, 's> Display for LRTable<'g, 's> { +impl Display for LRTable<'_, '_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { for state in &self.states { writeln!( diff --git a/rustemo/src/glr/gss.rs b/rustemo/src/glr/gss.rs index 73e50e0f..e1083b9f 100644 --- a/rustemo/src/glr/gss.rs +++ b/rustemo/src/glr/gss.rs @@ -26,7 +26,7 @@ pub struct GssGraph<'i, I: Input + ?Sized, S, P, TK: Copy>( Graph, Rc>>, ); -impl<'i, I, S, P, TK> Default for GssGraph<'i, I, S, P, TK> +impl Default for GssGraph<'_, I, S, P, TK> where I: Input + ?Sized, TK: Copy, @@ -183,7 +183,7 @@ where token_ahead: Option>, } -impl<'i, I, S, TK> Clone for GssHead<'i, I, S, TK> +impl Clone for GssHead<'_, I, S, TK> where I: Input + ?Sized, S: State, @@ -206,7 +206,7 @@ where } } -impl<'i, I: Input + ?Sized, S: Default, TK> Default for GssHead<'i, I, S, TK> { +impl Default for GssHead<'_, I, S, TK> { fn default() -> Self { Self { state: Default::default(), @@ -404,7 +404,7 @@ where } } -impl<'i, I, P, TK> Clone for SPPFTree<'i, I, P, TK> +impl Clone for SPPFTree<'_, I, P, TK> where I: Input + ?Sized, P: Clone, @@ -440,7 +440,7 @@ where pub layout: Option<&'i I>, } -impl<'i, I> Clone for TreeData<'i, I> +impl Clone for TreeData<'_, I> where I: Input + ?Sized, { @@ -470,7 +470,7 @@ where pub possibilities: RefCell>>>, } -impl<'i, I, P, TK> PartialEq for Parent<'i, I, P, TK> +impl PartialEq for Parent<'_, I, P, TK> where I: Input + ?Sized, TK: Copy, @@ -479,14 +479,14 @@ where self.root_node == other.root_node && self.head_node == other.head_node } } -impl<'i, I, P, TK> Eq for Parent<'i, I, P, TK> +impl Eq for Parent<'_, I, P, TK> where I: Input + ?Sized, TK: Copy, { } -impl<'i, I, P, TK> std::hash::Hash for Parent<'i, I, P, TK> +impl std::hash::Hash for Parent<'_, I, P, TK> where I: Input + ?Sized, TK: Copy, @@ -560,7 +560,7 @@ where root: Rc>, } -impl<'i, I, P, TK> Debug for Tree<'i, I, P, TK> +impl Debug for Tree<'_, I, P, TK> where I: Input + ?Sized + Debug, TK: Copy, @@ -817,7 +817,7 @@ where tree_idx: usize, } -impl<'i, 'f, I, P, TK> Iterator for ForestIterator<'i, 'f, I, P, TK> +impl<'i, I, P, TK> Iterator for ForestIterator<'i, '_, I, P, TK> where I: Input + ?Sized, TK: Copy, diff --git a/rustemo/src/glr/parser.rs b/rustemo/src/glr/parser.rs index 1c47ebd9..90bc2ab5 100644 --- a/rustemo/src/glr/parser.rs +++ b/rustemo/src/glr/parser.rs @@ -75,7 +75,7 @@ where root_head: NodeIndex, } -impl<'i, I, P, TK> Display for ReductionPath<'i, I, P, TK> +impl Display for ReductionPath<'_, I, P, TK> where I: Input + ?Sized, TK: Copy, diff --git a/rustemo/src/lexer.rs b/rustemo/src/lexer.rs index 22aaf35e..4a70635f 100644 --- a/rustemo/src/lexer.rs +++ b/rustemo/src/lexer.rs @@ -203,7 +203,7 @@ pub struct Token<'i, I: Input + ?Sized, TK> { pub location: Location, } -impl<'i, I: Input + ?Sized, TK: Copy> Clone for Token<'i, I, TK> { +impl Clone for Token<'_, I, TK> { fn clone(&self) -> Self { Self { kind: self.kind, @@ -213,7 +213,7 @@ impl<'i, I: Input + ?Sized, TK: Copy> Clone for Token<'i, I, TK> { } } -impl<'i, I, TK> Debug for Token<'i, I, TK> +impl Debug for Token<'_, I, TK> where I: Input + ?Sized, I::Output: Debug, diff --git a/rustemo/src/lr/builder.rs b/rustemo/src/lr/builder.rs index 7b9fee2b..e1e33617 100644 --- a/rustemo/src/lr/builder.rs +++ b/rustemo/src/lr/builder.rs @@ -41,7 +41,7 @@ where res_stack: Vec>, } -impl<'i, I, P, TK> TreeBuilder<'i, I, P, TK> +impl TreeBuilder<'_, I, P, TK> where I: Input + ?Sized, { @@ -50,7 +50,7 @@ where } } -impl<'i, I, P, TK> Default for TreeBuilder<'i, I, P, TK> +impl Default for TreeBuilder<'_, I, P, TK> where I: Input + ?Sized, { diff --git a/rustemo/src/lr/context.rs b/rustemo/src/lr/context.rs index 4d24e881..849654be 100644 --- a/rustemo/src/lr/context.rs +++ b/rustemo/src/lr/context.rs @@ -27,15 +27,13 @@ pub struct LRContext<'i, I: Input + ?Sized, S, TK> { state: S, } -impl<'i, I: Input + ?Sized, S: Default, TK> Default - for LRContext<'i, I, S, TK> -{ +impl Default for LRContext<'_, I, S, TK> { fn default() -> Self { Self::new(0) } } -impl<'i, I: Input + ?Sized, S: Default, TK> LRContext<'i, I, S, TK> { +impl LRContext<'_, I, S, TK> { pub fn new(position: usize) -> Self { Self { position,