1
0

Clean up with clippy

This commit is contained in:
Jeff 2024-08-02 15:21:15 -04:00
parent 2047e0bf82
commit 3fae807d9f
5 changed files with 16 additions and 17 deletions

View File

@ -258,7 +258,7 @@ mod tests {
Expression::Value(ValueNode::Integer(42).with_position((0, 0))),
Expression::Value(ValueNode::Integer(42).with_position((0, 0)))
)
.evaluate(&mut Context::new(), true, SourcePosition(0, 0)),
.evaluate(&Context::new(), true, SourcePosition(0, 0)),
Ok(Some(Evaluation::Return(Value::boolean(true))))
)
}
@ -270,7 +270,7 @@ mod tests {
Expression::Value(ValueNode::Integer(42).with_position((0, 0))),
Expression::Value(ValueNode::Integer(43).with_position((0, 0)))
)
.evaluate(&mut Context::new(), true, SourcePosition(0, 0)),
.evaluate(&Context::new(), true, SourcePosition(0, 0)),
Ok(Some(Evaluation::Return(Value::boolean(true))))
)
}
@ -282,7 +282,7 @@ mod tests {
Expression::Value(ValueNode::Integer(43).with_position((0, 0))),
Expression::Value(ValueNode::Integer(42).with_position((0, 0)))
)
.evaluate(&mut Context::new(), true, SourcePosition(0, 0)),
.evaluate(&Context::new(), true, SourcePosition(0, 0)),
Ok(Some(Evaluation::Return(Value::boolean(true))))
)
}
@ -294,7 +294,7 @@ mod tests {
Expression::Value(ValueNode::Integer(42).with_position((0, 0))),
Expression::Value(ValueNode::Integer(43).with_position((0, 0)))
)
.evaluate(&mut Context::new(), true, SourcePosition(0, 0)),
.evaluate(&Context::new(), true, SourcePosition(0, 0)),
Ok(Some(Evaluation::Return(Value::boolean(true))))
)
}
@ -306,7 +306,7 @@ mod tests {
Expression::Value(ValueNode::Integer(42).with_position((0, 0))),
Expression::Value(ValueNode::Integer(41).with_position((0, 0)))
)
.evaluate(&mut Context::new(), true, SourcePosition(0, 0)),
.evaluate(&Context::new(), true, SourcePosition(0, 0)),
Ok(Some(Evaluation::Return(Value::boolean(true))))
);
@ -315,7 +315,7 @@ mod tests {
Expression::Value(ValueNode::Integer(42).with_position((0, 0))),
Expression::Value(ValueNode::Integer(42).with_position((0, 0))),
)
.evaluate(&mut Context::new(), true, SourcePosition(0, 0)),
.evaluate(&Context::new(), true, SourcePosition(0, 0)),
Ok(Some(Evaluation::Return(Value::boolean(true))))
);
}
@ -327,7 +327,7 @@ mod tests {
Expression::Value(ValueNode::Integer(41).with_position((0, 0))),
Expression::Value(ValueNode::Integer(42).with_position((0, 0))),
)
.evaluate(&mut Context::new(), true, SourcePosition(0, 0)),
.evaluate(&Context::new(), true, SourcePosition(0, 0)),
Ok(Some(Evaluation::Return(Value::boolean(true))))
);
@ -336,7 +336,7 @@ mod tests {
Expression::Value(ValueNode::Integer(42).with_position((0, 0))),
Expression::Value(ValueNode::Integer(42).with_position((0, 0))),
)
.evaluate(&mut Context::new(), true, SourcePosition(0, 0)),
.evaluate(&Context::new(), true, SourcePosition(0, 0)),
Ok(Some(Evaluation::Return(Value::boolean(true))))
);
}
@ -348,7 +348,7 @@ mod tests {
Expression::Value(ValueNode::Boolean(true).with_position((0, 0))),
Expression::Value(ValueNode::Boolean(true).with_position((0, 0))),
)
.evaluate(&mut Context::new(), true, SourcePosition(0, 0)),
.evaluate(&Context::new(), true, SourcePosition(0, 0)),
Ok(Some(Evaluation::Return(Value::boolean(true))))
)
}
@ -360,7 +360,7 @@ mod tests {
Expression::Value(ValueNode::Boolean(true).with_position((0, 0))),
Expression::Value(ValueNode::Boolean(false).with_position((0, 0))),
)
.evaluate(&mut Context::new(), true, SourcePosition(0, 0)),
.evaluate(&Context::new(), true, SourcePosition(0, 0)),
Ok(Some(Evaluation::Return(Value::boolean(true))))
)
}
@ -371,7 +371,7 @@ mod tests {
Logic::Not(Expression::Value(
ValueNode::Boolean(false).with_position((0, 0))
))
.evaluate(&mut Context::new(), true, SourcePosition(0, 0)),
.evaluate(&Context::new(), true, SourcePosition(0, 0)),
Ok(Some(Evaluation::Return(Value::boolean(true))))
)
}

View File

@ -128,8 +128,7 @@ impl AbstractNode for ValueNode {
let found = variants
.into_iter()
.find(|(identifier, _)| identifier == &variant.node)
.is_some();
.any(|(identifier, _)| identifier == variant.node);
if !found {
return Err(ValidationError::EnumVariantNotFound {

View File

@ -345,7 +345,7 @@ pub fn parser<'src>(
type_name,
type_arguments,
variant,
content: content.map(|expression| Box::new(expression)),
content: content.map(Box::new),
}
.with_position(state.span()),
)

View File

@ -286,7 +286,7 @@ fn built_in_function() {
.map_err(|errors| {
errors
.into_iter()
.map(|error| DustError::from(error))
.map(DustError::from)
.collect::<Vec<DustError>>()
})
.unwrap();
@ -308,7 +308,7 @@ fn built_in_function_with_arg() {
.map_err(|errors| {
errors
.into_iter()
.map(|error| DustError::from(error))
.map(DustError::from)
.collect::<Vec<DustError>>()
})
.unwrap();

View File

@ -649,7 +649,7 @@ impl ValueInner {
}
}
ValueInner::Structure { name, .. } => {
if let Some(r#type) = context.get_type(&name)? {
if let Some(r#type) = context.get_type(name)? {
r#type
} else {
return Err(ValidationError::StructDefinitionNotFound {