Skip to content

Commit

Permalink
cargo clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
Glyphack committed Aug 27, 2023
1 parent a81818e commit 7f8ef87
Show file tree
Hide file tree
Showing 17 changed files with 402 additions and 409 deletions.
6 changes: 3 additions & 3 deletions parser/src/lexer/lexer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ impl Lexer {
}
}
3 => {
if curr == str_finisher.chars().nth(0).unwrap()
if curr == str_finisher.chars().next().unwrap()
&& self.peek() == Some(str_finisher.chars().nth(1).unwrap())
&& self.double_peek() == Some(str_finisher.chars().nth(2).unwrap())
{
Expand Down Expand Up @@ -140,7 +140,7 @@ impl Lexer {
}
}
3 => {
if peeked_char == str_finisher.chars().nth(0).unwrap()
if peeked_char == str_finisher.chars().next().unwrap()
&& self.double_peek() == Some(str_finisher.chars().nth(1).unwrap())
&& self.triple_peek() == Some(str_finisher.chars().nth(2).unwrap())
{
Expand All @@ -160,7 +160,7 @@ impl Lexer {
return Ok(indent_kind);
}
}
if self.fstring_stack.len() > 0 {
if !self.fstring_stack.is_empty() {
if let Some(kind) = self.next_fstring_token() {
return Ok(kind);
}
Expand Down
4 changes: 2 additions & 2 deletions parser/src/parser/ast.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ trait GetNode {
impl From<Node> for SourceSpan {
fn from(val: Node) -> Self {
Self::new(
SourceOffset::from(val.start as usize),
SourceOffset::from(val.len() as usize),
SourceOffset::from(val.start),
SourceOffset::from(val.len()),
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion parser/src/parser/diagnostics.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::{parser::ast::Node, token::Kind};
use crate::{parser::ast::Node};
use miette::{self, Diagnostic};
use thiserror::{self, Error};

Expand Down
2 changes: 1 addition & 1 deletion parser/src/parser/operator.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::parser::ast::{BinaryOperator, BooleanOperator, UnaryOperator};
use crate::parser::ast::{BooleanOperator, UnaryOperator};
use crate::token::Kind;

pub fn is_bool_op(kind: &Kind) -> bool {
Expand Down
Loading

0 comments on commit 7f8ef87

Please sign in to comment.