Merge pull request #23 from mwatts/feature/blobs

remove warnings about Itertools::intersperse
This commit is contained in:
Mark Watts 2021-08-22 17:09:42 -04:00 committed by GitHub
commit e64e2cf2f2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -57,10 +57,13 @@ impl Value {
{
let open = open.into();
let n = open.len() as isize;
let i = vs
let i = {
let this = vs
.into_iter()
.map(|v| v.as_doc(allocator))
.intersperse(allocator.line());
.map(|v| v.as_doc(allocator));
let element = allocator.line();
Itertools::intersperse(this, element)
};
allocator
.text(open)
.append(allocator.concat(i).nest(n))
@ -81,11 +84,14 @@ impl Value {
Value::List(ref vs) => self.bracket(pp, "(", vs, ")"),
Value::Set(ref vs) => self.bracket(pp, "#{", vs, "}"),
Value::Map(ref vs) => {
let xs = vs
let xs = {
let this = vs
.iter()
.rev()
.map(|(k, v)| k.as_doc(pp).append(pp.line()).append(v.as_doc(pp)).group())
.intersperse(pp.line());
.map(|(k, v)| k.as_doc(pp).append(pp.line()).append(v.as_doc(pp)).group());
let element = pp.line();
Itertools::intersperse(this, element)
};
pp.text("{")
.append(pp.concat(xs).nest(1))
.append(pp.text("}"))