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:
Vincent Ambo 2022-02-07 19:29:52 +03:00 committed by clbot
parent 8b8c98380e
commit 0d0b43ed88
16 changed files with 348 additions and 421 deletions

View file

@ -56,13 +56,14 @@ impl<'a> Resolver<'a> {
// The resolver does not clone references, so unless
// the interpreter is called before the resolver this
// case should never happen.
None => return Err(Error {
line: 0,
kind: ErrorKind::InternalError(
"multiple function references before interpretation"
.into(),
),
}),
None => {
return Err(Error {
line: 0,
kind: ErrorKind::InternalError(
"multiple function references before interpretation".into(),
),
})
}
},
}
}
@ -79,10 +80,7 @@ impl<'a> Resolver<'a> {
Ok(())
}
fn resolve_function(
&mut self,
func: &'a mut parser::Function,
) -> Result<(), Error> {
fn resolve_function(&mut self, func: &'a mut parser::Function) -> Result<(), Error> {
self.declare(&func.name.lexeme);
self.define(&func.name.lexeme);
@ -123,17 +121,13 @@ impl<'a> Resolver<'a> {
}
}
fn resolve_variable(
&mut self,
var: &'a mut parser::Variable,
) -> Result<(), Error> {
fn resolve_variable(&mut self, var: &'a mut parser::Variable) -> Result<(), Error> {
if let Some(scope) = self.scopes.last_mut() {
if let Some(false) = scope.get(var.name.lexeme.as_str()) {
return Err(Error {
line: var.name.line,
kind: ErrorKind::StaticError(
"can't read local variable in its own initialiser"
.into(),
"can't read local variable in its own initialiser".into(),
),
});
}
@ -143,10 +137,7 @@ impl<'a> Resolver<'a> {
Ok(())
}
fn resolve_assign(
&mut self,
assign: &'a mut parser::Assign,
) -> Result<(), Error> {
fn resolve_assign(&mut self, assign: &'a mut parser::Assign) -> Result<(), Error> {
self.resolve_expr(&mut assign.value)?;
assign.depth = self.resolve_local(&assign.name);
Ok(())
@ -162,10 +153,7 @@ impl<'a> Resolver<'a> {
None
}
fn resolve_call(
&mut self,
call: &'a mut parser::Call,
) -> Result<(), Error> {
fn resolve_call(&mut self, call: &'a mut parser::Call) -> Result<(), Error> {
self.resolve_expr(&mut call.callee)?;
for arg in call.args.iter_mut() {
@ -198,10 +186,7 @@ impl<'a> Resolver<'a> {
}
}
pub fn resolve(
globals: &[String],
block: &mut parser::Block,
) -> Result<(), Error> {
pub fn resolve(globals: &[String], block: &mut parser::Block) -> Result<(), Error> {
let mut resolver: Resolver = Default::default();
// Scope for static globals only starts, never ends.