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

View File

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

View File

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