Clean up with clippy
This commit is contained in:
parent
2047e0bf82
commit
3fae807d9f
@ -258,7 +258,7 @@ mod tests {
|
|||||||
Expression::Value(ValueNode::Integer(42).with_position((0, 0))),
|
Expression::Value(ValueNode::Integer(42).with_position((0, 0))),
|
||||||
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))))
|
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(42).with_position((0, 0))),
|
||||||
Expression::Value(ValueNode::Integer(43).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))))
|
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(43).with_position((0, 0))),
|
||||||
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))))
|
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(42).with_position((0, 0))),
|
||||||
Expression::Value(ValueNode::Integer(43).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))))
|
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(42).with_position((0, 0))),
|
||||||
Expression::Value(ValueNode::Integer(41).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))))
|
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))),
|
||||||
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))))
|
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(41).with_position((0, 0))),
|
||||||
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))))
|
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))),
|
||||||
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))))
|
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))),
|
||||||
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))))
|
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(true).with_position((0, 0))),
|
||||||
Expression::Value(ValueNode::Boolean(false).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))))
|
Ok(Some(Evaluation::Return(Value::boolean(true))))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -371,7 +371,7 @@ mod tests {
|
|||||||
Logic::Not(Expression::Value(
|
Logic::Not(Expression::Value(
|
||||||
ValueNode::Boolean(false).with_position((0, 0))
|
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))))
|
Ok(Some(Evaluation::Return(Value::boolean(true))))
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -128,8 +128,7 @@ impl AbstractNode for ValueNode {
|
|||||||
|
|
||||||
let found = variants
|
let found = variants
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.find(|(identifier, _)| identifier == &variant.node)
|
.any(|(identifier, _)| identifier == variant.node);
|
||||||
.is_some();
|
|
||||||
|
|
||||||
if !found {
|
if !found {
|
||||||
return Err(ValidationError::EnumVariantNotFound {
|
return Err(ValidationError::EnumVariantNotFound {
|
||||||
|
@ -345,7 +345,7 @@ pub fn parser<'src>(
|
|||||||
type_name,
|
type_name,
|
||||||
type_arguments,
|
type_arguments,
|
||||||
variant,
|
variant,
|
||||||
content: content.map(|expression| Box::new(expression)),
|
content: content.map(Box::new),
|
||||||
}
|
}
|
||||||
.with_position(state.span()),
|
.with_position(state.span()),
|
||||||
)
|
)
|
||||||
|
@ -286,7 +286,7 @@ fn built_in_function() {
|
|||||||
.map_err(|errors| {
|
.map_err(|errors| {
|
||||||
errors
|
errors
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|error| DustError::from(error))
|
.map(DustError::from)
|
||||||
.collect::<Vec<DustError>>()
|
.collect::<Vec<DustError>>()
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
@ -308,7 +308,7 @@ fn built_in_function_with_arg() {
|
|||||||
.map_err(|errors| {
|
.map_err(|errors| {
|
||||||
errors
|
errors
|
||||||
.into_iter()
|
.into_iter()
|
||||||
.map(|error| DustError::from(error))
|
.map(DustError::from)
|
||||||
.collect::<Vec<DustError>>()
|
.collect::<Vec<DustError>>()
|
||||||
})
|
})
|
||||||
.unwrap();
|
.unwrap();
|
||||||
|
@ -649,7 +649,7 @@ impl ValueInner {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ValueInner::Structure { name, .. } => {
|
ValueInner::Structure { name, .. } => {
|
||||||
if let Some(r#type) = context.get_type(&name)? {
|
if let Some(r#type) = context.get_type(name)? {
|
||||||
r#type
|
r#type
|
||||||
} else {
|
} else {
|
||||||
return Err(ValidationError::StructDefinitionNotFound {
|
return Err(ValidationError::StructDefinitionNotFound {
|
||||||
|
Loading…
Reference in New Issue
Block a user