From 0815ca54802b880d89a75e4382e58e182847c09e Mon Sep 17 00:00:00 2001 From: francois-caddet Date: Fri, 13 May 2022 19:44:57 +0200 Subject: [PATCH] some cleaning - unused variables and imports warnings fixed - move a `similar` to dev-dependencies because only used for prettyprinting tests --- Cargo.toml | 2 +- src/pretty.rs | 17 +++++++++-------- tests/pretty.rs | 4 ++-- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 56ea5446..cd4f4f69 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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 = [ diff --git a/src/pretty.rs b/src/pretty.rs index 41fe1a38..8e244712 100644 --- a/src/pretty.rs +++ b/src/pretty.rs @@ -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("#