on master help sign in
warnings
commit49021de049f1ba2f24b868a8e457b5ebacfcc601 authoriko <mail@iko.soy> dateSat 31 Aug 2024, 18:39 (2 years ago) parent284c591
4 files changed+9−15
nock/src/interpreter.rs+1−1 nock/src/jets.rs+5−6 nock/src/main.rs+3−6 nock/src/noun.rs−2
nock/src/interpreter.rs+1−1
@@ -114,7 +114,7 @@ fn fas_u32(addr: u32, noun: &Noun) -> Option<Rc<Noun>> {
114114 match addr {
115115 0 => None,
116116 1 => Some(Rc::new(noun.clone())),
117− n => match noun.borrow() {
117+ n => match noun {
118118 Noun::Atom(_) => None,
119119 Noun::Cell { p, q, .. } => match n {
120120 2 => Some(p.clone()),
nock/src/jets.rs+5−6
@@ -3,13 +3,12 @@ use murmur3::murmur3_32;
33use num_integer::Integer;
44use std::{
55 collections::BTreeMap,
6− io::Read,
76 iter::{once, repeat_n, zip},
87 rc::Rc,
98};
109
1110use crate::{
12− interpreter::{eval_gate, slam, InterpreterContext},
11+ interpreter::{slam, InterpreterContext},
1312 noun::{self, cell, Atom, Edge, Hair, Nail, Noun},
1413};
1514
@@ -336,7 +335,7 @@ static INTO: Jet = |_ctx, n| {
336335 .chain(once(c))
337336 .collect::<Vec<_>>()
338337 .iter()
339− .map(|x| x.clone()),
338+ .cloned(),
340339 )),
341340 }
342341};
@@ -433,7 +432,7 @@ static SCAG: Jet = |_ctx, n| {
433432 .take(a.as_u32().unwrap() as usize)
434433 .collect::<Vec<_>>()
435434 .iter()
436− .map(|x| x.clone()),
435+ .cloned(),
437436 ))
438437};
439438
@@ -444,8 +443,8 @@ static SKID: Jet = |ctx, n| {
444443 let (ys, ns): (Vec<_>, _) = slammed_n.iter().partition(|(l, _)| l.is_y());
445444
446445 Some(cell(
447− &Noun::list_refs(ys.iter().map(|(_, x)| x.clone())),
448− &Noun::list_refs(ns.iter().map(|(_, x)| x.clone())),
446+ &Noun::list_refs(ys.iter().map(|(_, x)| *x)),
447+ &Noun::list_refs(ns.iter().map(|(_, x)| *x)),
449448 ))
450449};
451450
nock/src/main.rs+3−6
@@ -1,18 +1,15 @@
1−use bitvec::ptr::read_unaligned;
21use clap::{command, error::Result, Parser, Subcommand};
2+use nock::interpreter::eval_gate;
33use nock::{
44 cue::cue_bytes,
5− interpreter::{self, eval_gate, generate_interpreter_context, slam},
5+ interpreter::{generate_interpreter_context, slam},
66 jam::jam_to_bytes,
77 noun::{cell, Atom, Noun},
88};
99use spinoff::Spinner;
1010use std::{
11− borrow::Borrow,
1211 fs::File,
13− io::{self, stdin, stdout, Read, Write},
14− os::unix::fs::FileExt,
15− panic::catch_unwind,
12+ io::{stdin, stdout, Read, Write},
1613 path::PathBuf,
1714 process::exit,
1815 rc::Rc,
nock/src/noun.rs−2
@@ -4,8 +4,6 @@ use num_bigint::BigUint;
44use std::fmt;
55use xxhash_rust::xxh3::xxh3_128;
66
7−use crate::interpreter::InterpreterContext;
8−
97pub type Atom = BigUint;
108
119pub type Hash = u128;