safe transmute: tweak Nfa::union to consume params by value

ref: https://github.com/rust-lang/rust/pull/92268#discussion_r925274516
This commit is contained in:
Jack Wrenn
2022-07-21 18:22:04 +00:00
parent b78c3daad0
commit 2268603046
+2 -2
View File
@@ -92,7 +92,7 @@ pub(crate) fn from_tree(tree: Tree<!, R>) -> Result<Self, Uninhabited> {
let mut alts = alts.into_iter().map(Self::from_tree);
let mut nfa = alts.next().ok_or(Uninhabited)??;
for alt in alts {
nfa = nfa.union(&alt?);
nfa = nfa.union(alt?);
}
nfa
}
@@ -136,7 +136,7 @@ pub(crate) fn concat(self, other: Self) -> Self {
}
/// Compute the union of two `Nfa`s.
pub(crate) fn union(&self, other: &Self) -> Self {
pub(crate) fn union(self, other: Self) -> Self {
let start = self.start;
let accepting = self.accepting;