mirror of
https://github.com/tweag/nickel.git
synced 2024-09-20 08:05:15 +03:00
Remove dead code
This commit is contained in:
parent
305fd7259d
commit
0c0f912005
@ -337,15 +337,6 @@ fn merge_closurize(
|
||||
body.closurize(env, local_env)
|
||||
}
|
||||
|
||||
/// Take two terms together with their environment, and return a closure representing their merge.
|
||||
/// Just call [`merge_closurize`](./fn.merge_closurize.html) in a new environment and return the
|
||||
/// result.
|
||||
fn mk_merge_closure(t1: RichTerm, env1: Environment, t2: RichTerm, env2: Environment) -> Closure {
|
||||
let mut env = HashMap::new();
|
||||
let body = merge_closurize(&mut env, t1, env1, t2, env2);
|
||||
Closure { body, env }
|
||||
}
|
||||
|
||||
/// Compose two contracts, given as terms.
|
||||
///
|
||||
/// To compose contracts `c1` and `c2`, construct the term `fun _l x => c1 l1 (c2 l2 x)`, where
|
||||
|
@ -1,34 +1,10 @@
|
||||
//! Serialization of an evaluated program to various data format.
|
||||
use crate::error::SerializationError;
|
||||
use crate::identifier::Ident;
|
||||
use crate::label::Label;
|
||||
use crate::term::{MetaValue, RichTerm, Term};
|
||||
use crate::types::Types;
|
||||
use serde::ser::{Error, Serialize, SerializeMap, Serializer};
|
||||
use std::collections::HashMap;
|
||||
|
||||
/// Serializer for docstring. Ignore the meta-data and serialize the underlying term.
|
||||
pub fn serialize_docstring<S>(_doc: &String, t: &RichTerm, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
t.serialize(serializer)
|
||||
}
|
||||
|
||||
/// Serializer for a contract with a default value. Ignore the meta-data and serialize the
|
||||
/// underlying term.
|
||||
pub fn serialize_contract_default<S>(
|
||||
_ty: &Types,
|
||||
_l: &Label,
|
||||
t: &RichTerm,
|
||||
serializer: S,
|
||||
) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: Serializer,
|
||||
{
|
||||
t.serialize(serializer)
|
||||
}
|
||||
|
||||
/// Serializer for metavalues.
|
||||
pub fn serialize_meta_value<S>(meta: &MetaValue, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
@ -85,6 +61,7 @@ pub fn validate(t: &RichTerm) -> Result<(), SerializationError> {
|
||||
vec.iter().try_for_each(validate)?;
|
||||
Ok(())
|
||||
}
|
||||
//TODO: have a specific error for such missing value.
|
||||
MetaValue(term::MetaValue {
|
||||
value: Some(ref t), ..
|
||||
}) => validate(t),
|
||||
|
@ -180,14 +180,8 @@ pub enum StrChunk<E> {
|
||||
),
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
impl<E> StrChunk<E> {
|
||||
pub fn literal<S>(s: S) -> Self
|
||||
where
|
||||
S: Into<String>,
|
||||
{
|
||||
StrChunk::Literal(s.into())
|
||||
}
|
||||
|
||||
pub fn expr(e: E) -> Self {
|
||||
StrChunk::Expr(e, 0)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user