fix(tvix/eval): address current clippy lints

Note that I've allowed `needless_lifetimes` for the attribute set
iterator, as I find the type easier to understand with these
annotations present.

Change-Id: I33abb17837ee4813076cdb9a87f54bac4a37044e
Reviewed-on: https://cl.tvl.fyi/c/depot/+/6373
Reviewed-by: sterni <sternenseemann@systemli.org>
Tested-by: BuildkiteCI
This commit is contained in:
Vincent Ambo 2022-08-31 04:56:02 +03:00 committed by tazjin
parent afcfa78364
commit f8919dbcd6
4 changed files with 5 additions and 5 deletions

View file

@ -71,7 +71,7 @@ pub enum LocalPosition {
/// Represents the different ways in which upvalues can be captured in
/// closures or thunks.
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub enum Upvalue {
/// This upvalue captures a local from the stack.
Local(LocalIdx),
@ -95,7 +95,7 @@ pub enum Upvalue {
/// is subtly different from its `StackIdx` (which excludes
/// uninitialised values in between).
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, PartialOrd)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd)]
pub struct LocalIdx(usize);
/// Represents a scope known during compilation, which can be resolved

View file

@ -13,12 +13,12 @@ pub struct CodeIdx(pub usize);
/// Index of a value in the runtime stack.
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct StackIdx(pub usize);
/// Index of an upvalue within a closure's upvalue list.
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct UpvalueIdx(pub usize);
/// Offset by which an instruction pointer should change in a jump.

View file

@ -215,6 +215,7 @@ impl NixAttrs {
self.0.contains(key)
}
#[allow(clippy::needless_lifetimes)]
pub fn iter<'a>(&'a self) -> Iter<KeyValue<'a>> {
Iter(match &self.0 {
AttrsRep::Map(map) => KeyValue::Map(map.iter()),

View file

@ -527,7 +527,6 @@ impl VM {
fn resolve_dynamic_upvalue(&mut self, ident_idx: ConstantIdx) -> EvalResult<Value> {
let chunk = self.chunk();
let ident = chunk.constant(ident_idx).as_str()?.to_string();
drop(chunk); // some lifetime trickery due to cell::Ref
// Peek at the current instruction (note: IP has already
// advanced!) to see if it is actually data indicating a