Fix clippy warnings

This commit is contained in:
Jakub Žádník 2021-09-05 01:40:15 +03:00
parent 6b4fee88c9
commit f0d469f1d4
3 changed files with 10 additions and 14 deletions

View File

@ -58,7 +58,7 @@ pub fn eval_expression(
Expr::Range(from, to, operator) => {
// TODO: Embed the min/max into Range and set max to be the true max
let from = if let Some(f) = from {
eval_expression(context, &f)?
eval_expression(context, f)?
} else {
Value::Int {
val: 0i64,
@ -67,7 +67,7 @@ pub fn eval_expression(
};
let to = if let Some(t) = to {
eval_expression(context, &t)?
eval_expression(context, t)?
} else {
Value::Int {
val: 100i64,

View File

@ -738,14 +738,12 @@ pub fn parse_range(
),
};
let step_op_span = if let Some(pos) = step_op_pos {
Some(Span::new(
let step_op_span = step_op_pos.map(|pos| {
Span::new(
span.start + pos,
span.start + pos + "..".len(), // Only ".." is allowed for step operator
))
} else {
None
};
)
});
let (range_op, range_op_str, range_op_span) = if let Some(pos) = token.find("..<") {
if pos == range_op_pos {
@ -849,12 +847,10 @@ pub(crate) fn parse_dollar_expr(
if contents.starts_with(b"$\"") {
parse_string_interpolation(working_set, span)
} else if let (expr, None) = parse_range(working_set, span) {
(expr, None)
} else {
if let (expr, None) = parse_range(working_set, span) {
(expr, None)
} else {
parse_variable_expr(working_set, span)
}
parse_variable_expr(working_set, span)
}
}

View File

@ -239,7 +239,7 @@ impl Value {
vals.iter()
.map(|x| x.to_string())
.collect::<Vec<String>>()
.join(", ".into())
.join(", ")
)
}
Value::String { val, .. } => val,