Skip to content

Commit

Permalink
🎨 Fix cargo clippy warnings
Browse files Browse the repository at this point in the history
semver: chore
  • Loading branch information
Somfic committed Oct 30, 2024
1 parent 675a034 commit fbc4569
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ impl<'de> Iterator for Lexer<'de> {
let mut number = String::new();
number.push(c);
while let Some(c) = self.remainder.chars().next() {
if c.is_digit(10) || c == '.' {
if c.is_ascii_digit() || c == '.' {
number.push(c);
self.remainder = &self.remainder[c.len_utf8()..];
self.byte_offset += c.len_utf8();
Expand Down
8 changes: 3 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
use std::vec;

use lexer::{Lexer, TokenKind};
use miette::{highlighters::Highlighter, LabeledSpan};
use owo_colors::{colors, styles, OwoColorize, Style, Styled};
use owo_colors::{Style, Styled};
use parser::Parser;
use std::vec;

pub mod lexer;
pub mod parser;
Expand Down Expand Up @@ -50,7 +48,7 @@ struct SomHighlighterState {}
impl miette::highlighters::Highlighter for SomHighlighter {
fn start_highlighter_state<'h>(
&'h self,
source: &dyn miette::SpanContents<'_>,
_source: &dyn miette::SpanContents<'_>,
) -> Box<dyn miette::highlighters::HighlighterState + 'h> {
Box::new(SomHighlighterState {})
}
Expand Down
2 changes: 1 addition & 1 deletion src/parser/expression/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ pub fn call<'de>(
.expect(TokenKind::Comma, "expected a comma between arguments")?;
}

let argument = parse(parser, BindingPower::None)?;
let argument = parse(parser, binding_power.clone())?;
arguments.push(argument);
}

Expand Down
9 changes: 4 additions & 5 deletions src/parser/lookup.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
use crate::lexer::{TokenKind, TokenValue};
use miette::Result;
use std::collections::HashMap;

use super::{
ast::{BinaryOperator, Expression, Primitive, Statement},
ast::{Expression, Primitive, Statement},
expression, statement, Parser,
};
use crate::lexer::TokenKind;
use miette::Result;
use std::collections::HashMap;

#[derive(Debug, Clone, PartialEq, PartialOrd)]
pub enum BindingPower {
Expand Down
9 changes: 3 additions & 6 deletions src/parser/mod.rs
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
use crate::lexer::{Lexer, Token, TokenKind};
use crate::lexer::Lexer;
use ast::{Statement, Symbol};
use lookup::{BindingPower, Lookup};
use miette::{Context, Error, Result};
use std::{borrow::Cow, collections::HashMap};
use lookup::Lookup;
use miette::Result;

pub mod ast;
pub mod expression;
pub mod lookup;
pub mod statement;

pub struct Parser<'de> {
source: &'de str,
lexer: Lexer<'de>,
lookup: Lookup<'de>,
}

impl<'de> Parser<'de> {
pub fn new(input: &'de str) -> Self {
Parser {
source: input,
lexer: Lexer::new(input),
lookup: Lookup::default(),
}
Expand Down

0 comments on commit fbc4569

Please sign in to comment.