fix(users/tazjin): rustfmt code with non-default settings
rustfmt only sometimes detects path-based nested config files (probably some kind of race?), so my users folder uses a separate formatting check for rustfmt to avoid flaky CI. Enough flakes around already ... Change-Id: Ifd862f9974f071b3a256643dd8e56c019116156a Reviewed-on: https://cl.tvl.fyi/c/depot/+/5242 Reviewed-by: tazjin <tazjin@tvl.su> Autosubmit: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI
This commit is contained in:
parent
8b8c98380e
commit
0d0b43ed88
16 changed files with 348 additions and 421 deletions
|
|
@ -118,12 +118,7 @@ impl VM {
|
|||
|
||||
OpCode::OpNegate => {
|
||||
let v = self.pop();
|
||||
with_type!(
|
||||
self,
|
||||
v,
|
||||
Value::Number(num),
|
||||
self.push(Value::Number(-num))
|
||||
);
|
||||
with_type!(self, v, Value::Number(num), self.push(Value::Number(-num)));
|
||||
}
|
||||
|
||||
OpCode::OpSubtract => binary_op!(self, Number, -),
|
||||
|
|
@ -141,15 +136,18 @@ impl VM {
|
|||
self.push(Value::String(new_s.into()));
|
||||
}
|
||||
|
||||
(Value::Number(n_a), Value::Number(n_b)) =>
|
||||
self.push(Value::Number(n_a + n_b)),
|
||||
(Value::Number(n_a), Value::Number(n_b)) => {
|
||||
self.push(Value::Number(n_a + n_b))
|
||||
}
|
||||
|
||||
_ => return Err(Error {
|
||||
line: self.chunk.get_line(self.ip - 1),
|
||||
kind: ErrorKind::TypeError(
|
||||
"'+' operator only works on strings and numbers".into()
|
||||
),
|
||||
})
|
||||
_ => {
|
||||
return Err(Error {
|
||||
line: self.chunk.get_line(self.ip - 1),
|
||||
kind: ErrorKind::TypeError(
|
||||
"'+' operator only works on strings and numbers".into(),
|
||||
),
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -205,8 +203,7 @@ impl VM {
|
|||
self.stack.len() > local_idx.0,
|
||||
"stack is not currently large enough for local"
|
||||
);
|
||||
self.stack[local_idx.0] =
|
||||
self.stack.last().unwrap().clone();
|
||||
self.stack[local_idx.0] = self.stack.last().unwrap().clone();
|
||||
}
|
||||
|
||||
OpCode::OpJumpPlaceholder(_) => {
|
||||
|
|
@ -255,9 +252,7 @@ impl VM {
|
|||
fn print_value(&self, val: Value) -> String {
|
||||
match val {
|
||||
Value::String(LoxString::Heap(s)) => s,
|
||||
Value::String(LoxString::Interned(id)) => {
|
||||
self.strings.lookup(id).into()
|
||||
}
|
||||
Value::String(LoxString::Interned(id)) => self.strings.lookup(id).into(),
|
||||
_ => format!("{:?}", val),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue