Skip to content

Commit 11e70bd

Browse files
Update core/entities::IntoIterator for Entities to iterate without collecting by updating the IntoIter type, and remove .collect().
Signed-off-by: Thomas Hill <[email protected]>
1 parent 1da976e commit 11e70bd

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

cedar-policy-core/src/entities.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -339,14 +339,15 @@ fn create_entity_map(es: impl Iterator<Item = Arc<Entity>>) -> Result<HashMap<En
339339
impl IntoIterator for Entities {
340340
type Item = Entity;
341341

342-
type IntoIter = std::vec::IntoIter<Entity>;
342+
type IntoIter = std::iter::Map<
343+
std::collections::hash_map::IntoValues<EntityUID, Arc<Entity>>,
344+
fn(Arc<Entity>) -> Entity,
345+
>;
343346

344347
fn into_iter(self) -> Self::IntoIter {
345348
self.entities
346349
.into_values()
347350
.map(Arc::unwrap_or_clone)
348-
.collect::<Vec<Entity>>()
349-
.into_iter()
350351
}
351352
}
352353

0 commit comments

Comments
 (0)