From 627cde0e236d86e8dfaf623225478008625a99f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9rome=20Eertmans?= Date: Mon, 2 Dec 2024 09:26:56 +0100 Subject: [PATCH] chore(lint): apply Clippy and Rustfmt --- logos-codegen/src/generator/fork.rs | 2 +- logos-codegen/src/generator/leaf.rs | 2 +- logos-codegen/src/generator/rope.rs | 2 +- logos-codegen/src/graph/fork.rs | 2 +- src/source.rs | 8 +++++--- tests/tests/source.rs | 5 ++++- 6 files changed, 13 insertions(+), 8 deletions(-) diff --git a/logos-codegen/src/generator/fork.rs b/logos-codegen/src/generator/fork.rs index 0f8eeec2..11d4eab2 100644 --- a/logos-codegen/src/generator/fork.rs +++ b/logos-codegen/src/generator/fork.rs @@ -10,7 +10,7 @@ use crate::util::ToIdent; type Targets = Map>; -impl<'a> Generator<'a> { +impl Generator<'_> { pub fn generate_fork(&mut self, this: NodeId, fork: &Fork, mut ctx: Context) -> TokenStream { let mut targets: Targets = Map::default(); diff --git a/logos-codegen/src/generator/leaf.rs b/logos-codegen/src/generator/leaf.rs index 04a6e983..0841a4ff 100644 --- a/logos-codegen/src/generator/leaf.rs +++ b/logos-codegen/src/generator/leaf.rs @@ -5,7 +5,7 @@ use crate::generator::{Context, Generator}; use crate::leaf::{Callback, Leaf}; use crate::util::MaybeVoid; -impl<'a> Generator<'a> { +impl Generator<'_> { pub fn generate_leaf(&mut self, leaf: &Leaf, mut ctx: Context) -> TokenStream { let bump = ctx.bump(); diff --git a/logos-codegen/src/generator/rope.rs b/logos-codegen/src/generator/rope.rs index 2c3e5dd2..ae3b07ad 100644 --- a/logos-codegen/src/generator/rope.rs +++ b/logos-codegen/src/generator/rope.rs @@ -4,7 +4,7 @@ use quote::quote; use crate::generator::{Context, Generator}; use crate::graph::Rope; -impl<'a> Generator<'a> { +impl Generator<'_> { pub fn generate_rope(&mut self, rope: &Rope, mut ctx: Context) -> TokenStream { let miss = ctx.miss(rope.miss.first(), self); let read = ctx.read(rope.pattern.len()); diff --git a/logos-codegen/src/graph/fork.rs b/logos-codegen/src/graph/fork.rs index 75142466..6b59836b 100644 --- a/logos-codegen/src/graph/fork.rs +++ b/logos-codegen/src/graph/fork.rs @@ -122,7 +122,7 @@ pub struct ForkIter<'a> { lut: &'a [Option; 256], } -impl<'a> Iterator for ForkIter<'a> { +impl Iterator for ForkIter<'_> { type Item = (Range, NodeId); fn next(&mut self) -> Option { diff --git a/src/source.rs b/src/source.rs index 37e5c6a4..5d7d85d8 100644 --- a/src/source.rs +++ b/src/source.rs @@ -241,8 +241,10 @@ where T: Deref, ::Target: Source, { - type Slice<'a> = ::Slice<'a> - where T: 'a; + type Slice<'a> + = ::Slice<'a> + where + T: 'a; fn len(&self) -> usize { self.deref().len() @@ -304,7 +306,7 @@ pub trait Chunk<'source>: Sized + Copy + PartialEq + Eq { fn from_slice(s: &'source [u8]) -> Option; } -impl<'source> Chunk<'source> for u8 { +impl Chunk<'_> for u8 { const SIZE: usize = 1; #[inline] diff --git a/tests/tests/source.rs b/tests/tests/source.rs index c31d2d28..58e77279 100644 --- a/tests/tests/source.rs +++ b/tests/tests/source.rs @@ -6,7 +6,10 @@ use logos_derive::Logos; struct RefSource<'s, S: ?Sized + Source>(&'s S); impl<'s, S: ?Sized + Source> Source for RefSource<'s, S> { - type Slice<'a> = S::Slice<'a> where 's: 'a; + type Slice<'a> + = S::Slice<'a> + where + 's: 'a; fn len(&self) -> usize { self.0.len()