Skip to content

Commit 46acedf

Browse files
committed
More clippy fixes
1 parent 77ec17a commit 46acedf

4 files changed

Lines changed: 9 additions & 10 deletions

File tree

ndc_lib/src/interpreter/evaluate/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
1-
use crate::ast::{
2-
Expression, ExpressionLocation, ForBody, ForIteration, LogicalOperator, Lvalue,
3-
};
1+
use crate::ast::{Expression, ExpressionLocation, ForBody, ForIteration, LogicalOperator, Lvalue};
42
use crate::hash_map::HashMap;
53
use crate::interpreter::environment::{Environment, EnvironmentRef};
64
use crate::interpreter::function::{Function, FunctionBody, FunctionCarrier, OverloadedFunction};

ndc_lib/src/interpreter/num.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ impl BinaryOperatorError {
224224

225225
pub fn undefined_operation(
226226
operator: BinaryOperator,
227-
left: ValueType,
228-
right: ValueType,
227+
left: &ValueType,
228+
right: &ValueType,
229229
) -> Self {
230230
Self(format!(
231231
"operator {operator} is not defined for {left} and {right}"
@@ -397,8 +397,8 @@ impl Number {
397397
(Self::Float(p1), Self::Float(p2)) => Ok(Self::Float(p1.rem_euclid(p2))),
398398
(left, right) => Err(BinaryOperatorError::undefined_operation(
399399
BinaryOperator::EuclideanModulo,
400-
ValueType::from(left),
401-
ValueType::from(right),
400+
&ValueType::from(left),
401+
&ValueType::from(right),
402402
)),
403403
}
404404
}

ndc_lib/src/interpreter/resolve.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -513,8 +513,9 @@ impl LexicalScope {
513513
pub fn get_slot_by_name(&self, find_ident: &str) -> Option<usize> {
514514
for (slot, ident_in_scope) in self.identifiers.iter().enumerate().rev() {
515515
let name_in_scope = match ident_in_scope {
516-
LexicalIdentifier::Variable { name } => name,
517-
LexicalIdentifier::Function { name, .. } => name,
516+
LexicalIdentifier::Variable { name } | LexicalIdentifier::Function { name, .. } => {
517+
name
518+
}
518519
};
519520

520521
if name_in_scope == find_ident {

ndc_lib/src/lexer/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ impl Iterator for Lexer<'_> {
118118
match (first, second) {
119119
(' ' | '\t' | '\r' | '\n', _) => {
120120
self.source.consume(1);
121-
continue 'iterator;
121+
continue;
122122
}
123123
('r', Some('"' | '#')) => {
124124
return Some(self.lex_string_literal());

0 commit comments

Comments
 (0)