From ba02162d97b7fc0dbc053e7729d78777128314f9 Mon Sep 17 00:00:00 2001 From: Lionel Sambuc Date: Sat, 25 Jul 2020 08:29:15 +0200 Subject: [PATCH] Skip the vec! macro to create an empty vector --- src/storage/model.rs | 4 ++-- src/storage/xyz.rs | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/storage/model.rs b/src/storage/model.rs index 09b143f..698a257 100644 --- a/src/storage/model.rs +++ b/src/storage/model.rs @@ -115,7 +115,7 @@ pub mod v1 { for (position, properties) in v { hashmap .entry(properties) - .or_insert_with(|| vec![]) + .or_insert_with(Vec::new) .push((space, position)); } } @@ -226,7 +226,7 @@ pub mod v2 { .entry(properties) .or_insert_with(HashMap::new) .entry(space) - .or_insert_with(|| vec![]) + .or_insert_with(Vec::new) .push(position.into()); } } diff --git a/src/storage/xyz.rs b/src/storage/xyz.rs index 36a6d05..0ea6a0e 100644 --- a/src/storage/xyz.rs +++ b/src/storage/xyz.rs @@ -180,9 +180,7 @@ fn convert(string: &str) -> Result, Error> { let (x, y, z) = (x - origin[0], y - origin[1], z - origin[2]); let (x, y, z) = (x * 0.039_062_5, y * 0.039_062_5, z * 0.039_062_5); - oids.entry(oid) - .or_insert_with(|| vec![]) - .push(vec![x, y, z]); + oids.entry(oid).or_insert_with(Vec::new).push(vec![x, y, z]); } } _ => trace!("line {:?}, values: {:?}", line, values),