forked from extern/nushell
Fix clippy warnings
This commit is contained in:
parent
6b4fee88c9
commit
f0d469f1d4
@ -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,
|
||||||
|
@ -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,14 +847,12 @@ 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 {
|
} else if let (expr, None) = parse_range(working_set, span) {
|
||||||
if let (expr, None) = parse_range(working_set, span) {
|
|
||||||
(expr, None)
|
(expr, None)
|
||||||
} else {
|
} else {
|
||||||
parse_variable_expr(working_set, span)
|
parse_variable_expr(working_set, span)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
pub fn parse_string_interpolation(
|
pub fn parse_string_interpolation(
|
||||||
working_set: &mut StateWorkingSet,
|
working_set: &mut StateWorkingSet,
|
||||||
|
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user