Skip to content

Commit

Permalink
lint: remove elided lifetimes
Browse files Browse the repository at this point in the history
  • Loading branch information
igordejanovic committed Oct 4, 2024
1 parent 3f0f3ce commit ccf30ef
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 26 deletions.
2 changes: 1 addition & 1 deletion rustemo-compiler/src/generator/actions/production.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<syn::Item> {
let ty = self
.types
Expand Down
12 changes: 6 additions & 6 deletions rustemo-compiler/src/table/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,17 +102,17 @@ 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();
self_ki.len() == other_ki.len()
&& 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,
Expand All @@ -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)
Expand Down Expand Up @@ -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(())
Expand Down Expand Up @@ -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!(
Expand Down
20 changes: 10 additions & 10 deletions rustemo/src/glr/gss.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub struct GssGraph<'i, I: Input + ?Sized, S, P, TK: Copy>(
Graph<GssHead<'i, I, S, TK>, Rc<Parent<'i, I, P, TK>>>,
);

impl<'i, I, S, P, TK> Default for GssGraph<'i, I, S, P, TK>
impl<I, S, P, TK> Default for GssGraph<'_, I, S, P, TK>
where
I: Input + ?Sized,
TK: Copy,
Expand Down Expand Up @@ -183,7 +183,7 @@ where
token_ahead: Option<Token<'i, I, TK>>,
}

impl<'i, I, S, TK> Clone for GssHead<'i, I, S, TK>
impl<I, S, TK> Clone for GssHead<'_, I, S, TK>
where
I: Input + ?Sized,
S: State,
Expand All @@ -206,7 +206,7 @@ where
}
}

impl<'i, I: Input + ?Sized, S: Default, TK> Default for GssHead<'i, I, S, TK> {
impl<I: Input + ?Sized, S: Default, TK> Default for GssHead<'_, I, S, TK> {
fn default() -> Self {
Self {
state: Default::default(),
Expand Down Expand Up @@ -404,7 +404,7 @@ where
}
}

impl<'i, I, P, TK> Clone for SPPFTree<'i, I, P, TK>
impl<I, P, TK> Clone for SPPFTree<'_, I, P, TK>
where
I: Input + ?Sized,
P: Clone,
Expand Down Expand Up @@ -440,7 +440,7 @@ where
pub layout: Option<&'i I>,
}

impl<'i, I> Clone for TreeData<'i, I>
impl<I> Clone for TreeData<'_, I>
where
I: Input + ?Sized,
{
Expand Down Expand Up @@ -470,7 +470,7 @@ where
pub possibilities: RefCell<Vec<Rc<SPPFTree<'i, I, P, TK>>>>,
}

impl<'i, I, P, TK> PartialEq for Parent<'i, I, P, TK>
impl<I, P, TK> PartialEq for Parent<'_, I, P, TK>
where
I: Input + ?Sized,
TK: Copy,
Expand All @@ -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<I, P, TK> 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<I, P, TK> std::hash::Hash for Parent<'_, I, P, TK>
where
I: Input + ?Sized,
TK: Copy,
Expand Down Expand Up @@ -560,7 +560,7 @@ where
root: Rc<SPPFTree<'i, I, P, TK>>,
}

impl<'i, I, P, TK> Debug for Tree<'i, I, P, TK>
impl<I, P, TK> Debug for Tree<'_, I, P, TK>
where
I: Input + ?Sized + Debug,
TK: Copy,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion rustemo/src/glr/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ where
root_head: NodeIndex,
}

impl<'i, I, P, TK> Display for ReductionPath<'i, I, P, TK>
impl<I, P, TK> Display for ReductionPath<'_, I, P, TK>
where
I: Input + ?Sized,
TK: Copy,
Expand Down
4 changes: 2 additions & 2 deletions rustemo/src/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<I: Input + ?Sized, TK: Copy> Clone for Token<'_, I, TK> {
fn clone(&self) -> Self {
Self {
kind: self.kind,
Expand All @@ -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<I, TK> Debug for Token<'_, I, TK>
where
I: Input + ?Sized,
I::Output: Debug,
Expand Down
4 changes: 2 additions & 2 deletions rustemo/src/lr/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ where
res_stack: Vec<TreeNode<'i, I, P, TK>>,
}

impl<'i, I, P, TK> TreeBuilder<'i, I, P, TK>
impl<I, P, TK> TreeBuilder<'_, I, P, TK>
where
I: Input + ?Sized,
{
Expand All @@ -50,7 +50,7 @@ where
}
}

impl<'i, I, P, TK> Default for TreeBuilder<'i, I, P, TK>
impl<I, P, TK> Default for TreeBuilder<'_, I, P, TK>
where
I: Input + ?Sized,
{
Expand Down
6 changes: 2 additions & 4 deletions rustemo/src/lr/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<I: Input + ?Sized, S: Default, TK> 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<I: Input + ?Sized, S: Default, TK> LRContext<'_, I, S, TK> {
pub fn new(position: usize) -> Self {
Self {
position,
Expand Down

0 comments on commit ccf30ef

Please sign in to comment.