1
1
mirror of https://github.com/tweag/nickel.git synced 2024-09-19 23:47:54 +03:00

some cleaning

- unused variables and imports warnings fixed
- move a `similar` to dev-dependencies because only used for
  prettyprinting tests
This commit is contained in:
francois-caddet 2022-05-13 19:44:57 +02:00
parent c0e2867ace
commit 0815ca5480
3 changed files with 12 additions and 11 deletions

View File

@ -55,7 +55,6 @@ wasm-bindgen = { version = "=0.2.74", optional = true, features = ["serde-serial
js-sys = { version = "0.3", optional = true }
serde_repr = { version = "0.1", optional = true }
pretty = "0.11.2"
similar = "2.1.0"
[dev-dependencies]
pretty_assertions = "0.5.1"
@ -63,6 +62,7 @@ assert_matches = "1.4.0"
criterion = "0.3"
pprof = { version = "0.4.4", features = ["criterion", "flamegraph"] }
nickel-lang-utilities = {path = "utilities", version = "0.1.0"}
similar = "2.1.0"
[workspace]
members = [

View File

@ -1,5 +1,5 @@
use crate::destruct::{self, Destruct};
use crate::term::{BinaryOp, MetaValue, RecordAttrs, RichTerm, Term, UnaryOp};
use crate::term::{BinaryOp, MetaValue, RichTerm, Term, UnaryOp};
use crate::types::{AbsType, Types};
pub use pretty::{DocAllocator, DocBuilder, Pretty};
use regex::Regex;
@ -192,8 +192,9 @@ where
match self {
Destruct::Record {
matches,
open,
rest,
// TODO: manage `..}` and `..x}` ending patterns
open: _,
rest: _,
..
} => allocator
.intersperse(
@ -253,7 +254,7 @@ where
allocator.escaped_string(s)
}
}
crate::term::StrChunk::Expr(e, i) => allocator
crate::term::StrChunk::Expr(e, _i) => allocator
.text(interp.clone())
.append(allocator.text("{"))
.append(e.to_owned().pretty(allocator))
@ -298,7 +299,7 @@ where
FunPattern(..) => {
let mut params = vec![];
let mut rt = &self;
while let FunPattern(id, dst, t) = rt.as_ref() {
while let FunPattern(id, _dst, t) = rt.as_ref() {
params.push(
if let Some(id) = id {
allocator.as_string(id)
@ -318,8 +319,8 @@ where
.append(allocator.softline())
.append(rt.to_owned().pretty(allocator).nest(2))
}
Lbl(lbl) => allocator.text("# <label>").append(allocator.hardline()),
Let(id, rt, body, ty) => allocator
Lbl(_lbl) => allocator.text("# <label>").append(allocator.hardline()),
Let(id, rt, body, _ty) => allocator
.text("let")
.append(allocator.space())
.append(allocator.as_string(id))
@ -468,7 +469,7 @@ where
fields,
dyn_fields, /* field whose name is defined by interpolation */
attr,
deps, /* dependency tracking between fields. None before the free var pass */
_deps, /* dependency tracking between fields. None before the free var pass */
) => allocator
.line()
.append(

View File

@ -2,8 +2,8 @@ use nickel_lang::pretty::*;
use nickel_lang::term::RichTerm;
use nickel_lang_utilities::parse;
use pretty::BoxAllocator;
use std::borrow::Borrow;
use std::io::{Cursor, Read, Write};
use std::io::{Cursor, Read};
use std::path::PathBuf;
fn diff(s1: &str, s2: &str) {