fix clippy lints

This commit is contained in:
りき萌 2024-10-23 20:12:02 +02:00
parent 7c40505d7d
commit e19e47e6ad
6 changed files with 7 additions and 7 deletions

View file

@ -25,7 +25,7 @@ pub struct Walk<'a> {
index: usize, index: usize,
} }
impl<'a> Walk<'a> { impl Walk<'_> {
/// Walk to the first non-Nil, non-Error, non-Token node. /// Walk to the first non-Nil, non-Error, non-Token node.
pub fn node(&mut self) -> Option<NodeId> { pub fn node(&mut self) -> Option<NodeId> {
while let Some(id) = self.next() { while let Some(id) = self.next() {
@ -57,7 +57,7 @@ impl<'a> Walk<'a> {
} }
} }
impl<'a> Iterator for Walk<'a> { impl Iterator for Walk<'_> {
type Item = NodeId; type Item = NodeId;
fn next(&mut self) -> Option<Self::Item> { fn next(&mut self) -> Option<Self::Item> {

View file

@ -1,7 +1,7 @@
use core::{cell::Cell, error::Error, fmt}; use core::{cell::Cell, error::Error, fmt};
use alloc::vec::Vec; use alloc::vec::Vec;
use log::{error, info}; use log::error;
use crate::{ use crate::{
ast::{Ast, NodeAllocError, NodeId, NodeKind}, ast::{Ast, NodeAllocError, NodeId, NodeKind},
@ -231,7 +231,7 @@ impl<'a> Parser<'a> {
} }
} }
impl<'a> fmt::Debug for Parser<'a> { impl fmt::Debug for Parser<'_> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("Parser") f.debug_struct("Parser")
.field("events", &self.events) .field("events", &self.events)

View file

@ -23,6 +23,7 @@ impl fmt::Debug for Span {
} }
/// Source code string with a verified size limit. /// Source code string with a verified size limit.
///
/// An exact size limit is not enforced by this type - it only ensures the string isn't longer than /// An exact size limit is not enforced by this type - it only ensures the string isn't longer than
/// intended, to not stall the parser for an unexpected amount of time. /// intended, to not stall the parser for an unexpected amount of time.
#[derive(Debug, PartialEq, Eq)] #[derive(Debug, PartialEq, Eq)]

View file

@ -110,7 +110,7 @@ pub struct TokenKindSet {
} }
impl TokenKindSet { impl TokenKindSet {
const WORDS: usize = ((TokenKind::Error as u32 + u32::BITS - 1) / (u32::BITS)) as usize; const WORDS: usize = (TokenKind::Error as u32).div_ceil(u32::BITS) as usize;
const fn word(kind: TokenKind) -> usize { const fn word(kind: TokenKind) -> usize {
(kind as u32 / u32::BITS) as usize (kind as u32 / u32::BITS) as usize

View file

@ -5,7 +5,6 @@ use core::{
}; };
use alloc::{string::String, vec::Vec}; use alloc::{string::String, vec::Vec};
use log::debug;
use crate::{ use crate::{
bytecode::{self, Defs, Opcode, TagId, CAPTURE_CAPTURE, CAPTURE_LOCAL}, bytecode::{self, Defs, Opcode, TagId, CAPTURE_CAPTURE, CAPTURE_LOCAL},

View file

@ -16,7 +16,7 @@ impl<T> DeserializeFromStr<T> {
} }
} }
impl<'de, T> Visitor<'de> for DeserializeFromStr<T> impl<T> Visitor<'_> for DeserializeFromStr<T>
where where
T: FromStr, T: FromStr,
T::Err: Display, T::Err: Display,