diff options
Diffstat (limited to 'tvix/eval')
-rw-r--r-- | tvix/eval/src/builtins/to_xml.rs | 4 | ||||
-rw-r--r-- | tvix/eval/src/compiler/mod.rs | 4 | ||||
-rw-r--r-- | tvix/eval/src/value/mod.rs | 8 | ||||
-rw-r--r-- | tvix/eval/src/value/thunk.rs | 26 |
4 files changed, 21 insertions, 21 deletions
diff --git a/tvix/eval/src/builtins/to_xml.rs b/tvix/eval/src/builtins/to_xml.rs index 4176c8146e34..750bb27aa226 100644 --- a/tvix/eval/src/builtins/to_xml.rs +++ b/tvix/eval/src/builtins/to_xml.rs @@ -67,7 +67,7 @@ fn value_variant_to_xml<W: Write>(w: &mut EventWriter<W>, value: &Value) -> Resu w.write(XmlEvent::start_element("list"))?; for elem in list.into_iter() { - value_variant_to_xml(w, &elem)?; + value_variant_to_xml(w, elem)?; } w.write(XmlEvent::end_element()) @@ -78,7 +78,7 @@ fn value_variant_to_xml<W: Write>(w: &mut EventWriter<W>, value: &Value) -> Resu for elem in attrs.iter() { w.write(XmlEvent::start_element("attr").attr("name", elem.0.as_str()))?; - value_variant_to_xml(w, &elem.1)?; + value_variant_to_xml(w, elem.1)?; w.write(XmlEvent::end_element())?; } diff --git a/tvix/eval/src/compiler/mod.rs b/tvix/eval/src/compiler/mod.rs index 31e96955f0a5..83b1f01a8047 100644 --- a/tvix/eval/src/compiler/mod.rs +++ b/tvix/eval/src/compiler/mod.rs @@ -85,7 +85,7 @@ pub(crate) type GlobalsMap = HashMap<&'static str, Value>; /// the global scope, meaning that they can be accessed not just /// through `builtins.<name>`, but directly as `<name>`. This is not /// configurable, it is based on what Nix 2.3 exposed. -const GLOBAL_BUILTINS: &'static [&'static str] = &[ +const GLOBAL_BUILTINS: &[&str] = &[ "abort", "baseNameOf", "derivation", @@ -1408,7 +1408,7 @@ pub fn prepare_globals( // If "source builtins" were supplied, compile them and insert // them. builtins.extend(src_builtins.into_iter().map(move |(name, code)| { - let compiled = compile_src_builtin(name, code, &source, &weak); + let compiled = compile_src_builtin(name, code, &source, weak); (name, compiled) })); diff --git a/tvix/eval/src/value/mod.rs b/tvix/eval/src/value/mod.rs index 8b0b75e8668a..ede93e7dddd2 100644 --- a/tvix/eval/src/value/mod.rs +++ b/tvix/eval/src/value/mod.rs @@ -521,7 +521,7 @@ impl Display for Value { fn total_fmt_float<F: std::fmt::Write>(num: f64, mut f: F) -> std::fmt::Result { let mut buf = [b'0'; lexical_core::BUFFER_SIZE]; let mut s = lexical_core::write_with_options::<f64, { CXX_LITERAL }>( - num.clone(), + num, &mut buf, &WRITE_FLOAT_OPTIONS, ); @@ -566,7 +566,7 @@ fn total_fmt_float<F: std::fmt::Write>(num: f64, mut f: F) -> std::fmt::Result { if c == &b'.' { // trim zeroes from the right side. let frac = String::from_utf8_lossy(&s[i + 1..]); - let frac_no_trailing_zeroes = frac.trim_end_matches("0"); + let frac_no_trailing_zeroes = frac.trim_end_matches('0'); if frac.len() != frac_no_trailing_zeroes.len() { // we managed to strip something, construct new_s @@ -587,7 +587,7 @@ fn total_fmt_float<F: std::fmt::Write>(num: f64, mut f: F) -> std::fmt::Result { } } - write!(f, "{}", format!("{}", String::from_utf8_lossy(&s))) + write!(f, "{}", format!("{}", String::from_utf8_lossy(s))) } impl TotalDisplay for Value { @@ -671,7 +671,7 @@ mod tests { (1e6, "1e+06"), (-2E-2, "-0.02"), (6.626e-34, "6.626e-34"), - (9_224_617.445_991_228_313, "9.22462e+06"), + (9_224_617.445_991_227, "9.22462e+06"), ]; for (n, expected) in ff.iter() { let mut buf = String::new(); diff --git a/tvix/eval/src/value/thunk.rs b/tvix/eval/src/value/thunk.rs index 747cd413e23e..560e33244da3 100644 --- a/tvix/eval/src/value/thunk.rs +++ b/tvix/eval/src/value/thunk.rs @@ -192,7 +192,7 @@ impl Thunk { match inner { // If there was already a blackhole in the thunk, this is an // evaluation cycle. - ThunkRepr::Blackhole => return Err(ErrorKind::InfiniteRecursion), + ThunkRepr::Blackhole => Err(ErrorKind::InfiniteRecursion), // If there is a native function stored in the thunk, evaluate it // and replace this thunk's representation with it. Then bounces off @@ -203,13 +203,13 @@ impl Thunk { self.0.replace(ThunkRepr::Evaluated(value)); let self_clone = self.clone(); - return Ok(Trampoline { + Ok(Trampoline { action: None, continuation: Some(Box::new(move |vm| { Thunk::force_trampoline(vm, Value::Thunk(self_clone)) .map_err(|kind| Error::new(kind, todo!("BUG: b/238"))) })), - }); + }) } // When encountering a suspended thunk, construct a trampoline that @@ -227,7 +227,7 @@ impl Thunk { // into the continuation closure. let self_clone = self.clone(); - return Ok(Trampoline { + Ok(Trampoline { // Ask VM to enter frame of this thunk ... action: Some(TrampolineAction::EnterFrame { lambda, @@ -246,7 +246,7 @@ impl Thunk { Thunk::force_trampoline(vm, Value::Thunk(self_clone)) .map_err(|kind| Error::new(kind, light_span.span())) })), - }); + }) } // Note by tazjin: I have decided at this point to fully unroll the inner thunk handling @@ -261,7 +261,7 @@ impl Thunk { ThunkRepr::Evaluated(Value::Thunk(ref inner)) if inner.is_forced() => { self.0.replace(ThunkRepr::Evaluated(inner.value().clone())); vm.push(inner.value().clone()); - return Ok(Trampoline::default()); + Ok(Trampoline::default()) } // Otherwise we handle inner thunks mostly as above, with the @@ -272,7 +272,7 @@ impl Thunk { let inner_repr = inner.0.replace(ThunkRepr::Blackhole); match inner_repr { - ThunkRepr::Blackhole => return Err(ErrorKind::InfiniteRecursion), + ThunkRepr::Blackhole => Err(ErrorKind::InfiniteRecursion), // Same as for the native case above, but results are placed // in *both* thunks. @@ -282,13 +282,13 @@ impl Thunk { inner.0.replace(ThunkRepr::Evaluated(value)); let self_clone = self.clone(); - return Ok(Trampoline { + Ok(Trampoline { action: None, continuation: Some(Box::new(move |vm| { Thunk::force_trampoline(vm, Value::Thunk(self_clone)) .map_err(|kind| Error::new(kind, todo!("BUG: b/238"))) })), - }); + }) } // Inner suspended thunks are trampolined to the VM, and @@ -301,7 +301,7 @@ impl Thunk { let self_clone = self.clone(); let inner_clone = inner.clone(); - return Ok(Trampoline { + Ok(Trampoline { // Ask VM to enter frame of this thunk ... action: Some(TrampolineAction::EnterFrame { lambda, @@ -325,7 +325,7 @@ impl Thunk { Thunk::force_trampoline(vm, Value::Thunk(self_clone)) .map_err(|kind| Error::new(kind, light_span.span())) })), - }); + }) } // If the inner thunk is some arbitrary other value (this is @@ -344,7 +344,7 @@ impl Thunk { inner.0.replace(ThunkRepr::Evaluated(v)); let self_clone = self.clone(); - return Ok(Trampoline { + Ok(Trampoline { action: None, continuation: Some(Box::new(move |vm: &mut VM| { // TODO(tazjin): not sure about this span ... @@ -352,7 +352,7 @@ impl Thunk { Thunk::force_trampoline(vm, Value::Thunk(self_clone)) .map_err(|kind| Error::new(kind, todo!("BUG: b/238"))) })), - }); + }) } } } |