Skip the vec! macro to create an empty vector

This commit is contained in:
2020-07-25 08:29:15 +02:00
parent 9cab1916c9
commit ba02162d97
2 changed files with 3 additions and 5 deletions

View File

@@ -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());
}
}

View File

@@ -180,9 +180,7 @@ fn convert(string: &str) -> Result<Vec<SpatialObject>, 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),