Skip to content

Commit

Permalink
Fix clippy and rustdoc warnings, remove unneeded code
Browse files Browse the repository at this point in the history
  • Loading branch information
yannham committed Feb 13, 2024
1 parent 8900d09 commit 81018e4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 24 deletions.
11 changes: 0 additions & 11 deletions core/src/eval/operation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1166,17 +1166,6 @@ impl<R: ImportResolver, C: Cache> VirtualMachine<R, C> {
.pop_arg(&self.cache)
.ok_or_else(|| EvalError::NotEnoughArgs(2, String::from("with_env"), pos_op))?;

// This is fragile...unwrapping all the closures to reach an actual term (and, more
// importantly, and environment)
loop {
match_sharedterm!(match (cont.body.term) {
Term::Closure(idx) => {
cont = self.cache.get(idx);
}
_ => break,
});
}

match_sharedterm!(match (t) {
Term::Record(data) => {
for (id, field) in data.fields {
Expand Down
4 changes: 2 additions & 2 deletions core/src/term/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1384,8 +1384,8 @@ pub enum UnaryOp {
/// evaluate a pattern branch given as a second argument (which isn't a proper primop argument
/// but is stored on the stack) in its environment augmented with the bindings.
///
/// [Self::PatternBranch()] isn't specific to pattern branches: what it does is to take a set
/// of extra bindings and a term, and run the term in the augmented environment. While it could
/// [Self::PatternBranch] isn't specific to pattern branches: what it does is to take a set of
/// extra bindings and a term, and run the term in the augmented environment. While it could
/// useful to implement other operations, it would be fragile as a generic `with_env` operator,
/// because the term to be run must not be burried into a closure, or the environment
/// augmentation would be shallow and have no effect on the actual content of the term (we have
Expand Down
19 changes: 8 additions & 11 deletions core/src/term/pattern/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
//! a bottleneck.
//!
//! Most build blocks are generated programmatically rather than written out as e.g. members of the
//! [internals][crate::stdlib::internals] stdlib module. While clunkier, this lets more easily
//! change the compilation strategy in the future and is already a more efficient in the current
//! setting (combining building blocks from the standard library would require much more function
//! applications, while we can generate inlined versions on-the-fly here).
//! [internals] stdlib module. While clunkier, this lets more easily change the compilation
//! strategy in the future and is already a more efficient in the current setting (combining
//! building blocks from the standard library would require much more function applications, while
//! we can generate inlined versions on-the-fly here).
use super::*;
use crate::{
mk_app,
Expand Down Expand Up @@ -64,10 +64,7 @@ fn insert_binding(id: LocIdent, value_id: LocIdent, bindings_id: LocIdent) -> Ri
/// )
/// ```
fn remove_from_rest(rest_field: LocIdent, field: LocIdent, bindings_id: LocIdent) -> RichTerm {
let rest = make::op1(
UnaryOp::StaticAccess(rest_field.into()),
Term::Var(bindings_id),
);
let rest = make::op1(UnaryOp::StaticAccess(rest_field), Term::Var(bindings_id));

let rest_shrinked = make::op2(
BinaryOp::DynRemove(RecordOpKind::ConsiderAllFields),
Expand Down Expand Up @@ -262,7 +259,7 @@ impl CompilePart for RecordPattern {
make::op1(
UnaryOp::StaticAccess(field),
make::op1(
UnaryOp::StaticAccess(rest_field.into()),
UnaryOp::StaticAccess(rest_field),
Term::Var(local_bindings_id),
),
),
Expand Down Expand Up @@ -328,7 +325,7 @@ impl CompilePart for RecordPattern {
make::op2(
BinaryOp::Eq(),
make::op1(
UnaryOp::StaticAccess(rest_field.into()),
UnaryOp::StaticAccess(rest_field),
Term::Var(final_bindings_id)
),
Term::Record(RecordData::empty())
Expand Down Expand Up @@ -361,7 +358,7 @@ impl CompilePart for RecordPattern {
Term::Var(final_bindings_id),
),
make::op1(
UnaryOp::StaticAccess(rest_field.into()),
UnaryOp::StaticAccess(rest_field),
Term::Var(final_bindings_id)
)
),
Expand Down

0 comments on commit 81018e4

Please sign in to comment.