Skip to content

Commit

Permalink
Simplify invalidation_set
Browse files Browse the repository at this point in the history
  • Loading branch information
acl-cqc committed Nov 8, 2023
1 parent ce9311a commit bbb172d
Showing 1 changed file with 3 additions and 13 deletions.
16 changes: 3 additions & 13 deletions src/hugr/rewrite/replace.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
//! Implementation of the `Replace` operation.
use std::collections::hash_map::Values;
use std::collections::{HashMap, HashSet, VecDeque};
use std::iter::{Chain, Copied, Take};
use std::iter::Copied;
use std::slice::Iter;

use itertools::Itertools;
Expand Down Expand Up @@ -217,12 +216,7 @@ impl Rewrite for Replacement {

type ApplyResult = ();

type InvalidationSet<'a> = //<Vec<Node> as IntoIterator>::IntoIter
Chain<
Chain<
Copied<Iter<'a, Node>>,
Copied<Values<'a, Node, Node>>>,
Copied<Take<Iter<'a, Node>>>>
type InvalidationSet<'a> = Copied<Iter<'a, Node>>
where
Self: 'a;

Expand Down Expand Up @@ -334,11 +328,7 @@ impl Rewrite for Replacement {
}

fn invalidation_set(&self) -> Self::InvalidationSet<'_> {
self.removal
.iter()
.copied()
.chain(self.adoptions.values().copied())
.chain(self.removal.iter().take(1).copied())
self.removal.iter().copied()
}
}

Expand Down

0 comments on commit bbb172d

Please sign in to comment.