From 09eaa0d4ae63b0513c934535a40fa2aaa25846e1 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sat, 3 Sep 2022 04:20:00 +0300 Subject: fix(tvix/eval): address current clippy & grfn lints Change-Id: I65c6feb9f817b5b367d37204a1f57acfe4100d97 Reviewed-on: https://cl.tvl.fyi/c/depot/+/6430 Reviewed-by: sterni Tested-by: BuildkiteCI --- tvix/eval/src/compiler/mod.rs | 8 +++++--- tvix/eval/src/compiler/scope.rs | 9 +++++---- 2 files changed, 10 insertions(+), 7 deletions(-) (limited to 'tvix/eval/src/compiler') diff --git a/tvix/eval/src/compiler/mod.rs b/tvix/eval/src/compiler/mod.rs index f9a2dd32c8..269604a859 100644 --- a/tvix/eval/src/compiler/mod.rs +++ b/tvix/eval/src/compiler/mod.rs @@ -54,6 +54,7 @@ impl LambdaCtx { } } + #[allow(clippy::let_and_return)] // due to disassembler fn inherit(&self) -> Self { let ctx = LambdaCtx { lambda: Lambda::new_anonymous(), @@ -61,6 +62,7 @@ impl LambdaCtx { }; #[cfg(feature = "disassembler")] + #[allow(clippy::redundant_closure_call)] let ctx = (|mut c: Self| { c.lambda.chunk.codemap = self.lambda.chunk.codemap.clone(); c @@ -822,7 +824,7 @@ impl Compiler<'_> { LocalPosition::Recursive(idx) => self.thunk(slot, &node, move |compiler, node, _| { let upvalue_idx = compiler.add_upvalue( compiler.contexts.len() - 1, - &node, + node, UpvalueKind::Local(idx), ); compiler.push_op(OpCode::OpGetUpvalue(upvalue_idx), node); @@ -1350,10 +1352,10 @@ fn prepare_globals(additional: HashMap<&'static str, Value>) -> GlobalsMap { globals } -pub fn compile<'code>( +pub fn compile( expr: ast::Expr, location: Option, - file: &'code codemap::File, + file: &codemap::File, globals: HashMap<&'static str, Value>, #[cfg(feature = "disassembler")] codemap: Rc, diff --git a/tvix/eval/src/compiler/scope.rs b/tvix/eval/src/compiler/scope.rs index eb722a2c69..874c6168c1 100644 --- a/tvix/eval/src/compiler/scope.rs +++ b/tvix/eval/src/compiler/scope.rs @@ -180,10 +180,11 @@ impl Scope { /// correctly nesting scopes in lambdas and thunks when special /// scope features like poisoning are present). pub fn inherit(&self) -> Self { - let mut scope = Self::default(); - scope.poisoned_tokens = self.poisoned_tokens.clone(); - scope.scope_depth = self.scope_depth; - scope + Self { + poisoned_tokens: self.poisoned_tokens.clone(), + scope_depth: self.scope_depth, + ..Default::default() + } } /// Check whether a given token is poisoned. -- cgit 1.4.1