Skip to content

Commit

Permalink
chore(lint): apply Clippy and Rustfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
jeertmans committed Dec 2, 2024
1 parent a8f9a24 commit 627cde0
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion logos-codegen/src/generator/fork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use crate::util::ToIdent;

type Targets = Map<NodeId, Vec<Range>>;

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();

Expand Down
2 changes: 1 addition & 1 deletion logos-codegen/src/generator/leaf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion logos-codegen/src/generator/rope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion logos-codegen/src/graph/fork.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ pub struct ForkIter<'a> {
lut: &'a [Option<NodeId>; 256],
}

impl<'a> Iterator for ForkIter<'a> {
impl Iterator for ForkIter<'_> {
type Item = (Range, NodeId);

fn next(&mut self) -> Option<Self::Item> {
Expand Down
8 changes: 5 additions & 3 deletions src/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,10 @@ where
T: Deref,
<T as Deref>::Target: Source,
{
type Slice<'a> = <T::Target as Source>::Slice<'a>
where T: 'a;
type Slice<'a>
= <T::Target as Source>::Slice<'a>
where
T: 'a;

fn len(&self) -> usize {
self.deref().len()
Expand Down Expand Up @@ -304,7 +306,7 @@ pub trait Chunk<'source>: Sized + Copy + PartialEq + Eq {
fn from_slice(s: &'source [u8]) -> Option<Self>;
}

impl<'source> Chunk<'source> for u8 {
impl Chunk<'_> for u8 {
const SIZE: usize = 1;

#[inline]
Expand Down
5 changes: 4 additions & 1 deletion tests/tests/source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit 627cde0

Please sign in to comment.