Simplify code.
This commit is contained in:
parent
b091fea17b
commit
3174b4759e
10
src/ast.rs
10
src/ast.rs
@ -2003,14 +2003,12 @@ impl fmt::Debug for Expr {
|
|||||||
}
|
}
|
||||||
Self::Variable(i, _, x) => {
|
Self::Variable(i, _, x) => {
|
||||||
f.write_str("Variable(")?;
|
f.write_str("Variable(")?;
|
||||||
match x.1 {
|
if let Some((_, ref namespace)) = x.1 {
|
||||||
Some((_, ref namespace)) => write!(f, "{}", namespace)?,
|
write!(f, "{}", namespace)?
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
f.write_str(&x.2)?;
|
f.write_str(&x.2)?;
|
||||||
match i.map_or_else(|| x.0, |n| NonZeroUsize::new(n.get() as usize)) {
|
if let Some(n) = i.map_or_else(|| x.0, |n| NonZeroUsize::new(n.get() as usize)) {
|
||||||
Some(n) => write!(f, " #{}", n)?,
|
write!(f, " #{}", n)?
|
||||||
_ => (),
|
|
||||||
}
|
}
|
||||||
f.write_str(")")
|
f.write_str(")")
|
||||||
}
|
}
|
||||||
|
@ -2722,12 +2722,10 @@ impl Engine {
|
|||||||
if let Some(func) = func {
|
if let Some(func) = func {
|
||||||
// Add the loop variables
|
// Add the loop variables
|
||||||
let orig_scope_len = scope.len();
|
let orig_scope_len = scope.len();
|
||||||
let counter_index = if let Some(Ident { name, .. }) = counter {
|
let counter_index = counter.as_ref().map(|Ident { name, .. }| {
|
||||||
scope.push(unsafe_cast_var_name_to_lifetime(name), 0 as INT);
|
scope.push(unsafe_cast_var_name_to_lifetime(name), 0 as INT);
|
||||||
Some(scope.len() - 1)
|
scope.len() - 1
|
||||||
} else {
|
});
|
||||||
None
|
|
||||||
};
|
|
||||||
scope.push(unsafe_cast_var_name_to_lifetime(name), ());
|
scope.push(unsafe_cast_var_name_to_lifetime(name), ());
|
||||||
let index = scope.len() - 1;
|
let index = scope.len() - 1;
|
||||||
state.scope_level += 1;
|
state.scope_level += 1;
|
||||||
|
Loading…
Reference in New Issue
Block a user