mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-23 07:14:28 +00:00
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:
parent
b78c3daad0
commit
2268603046
@ -92,7 +92,7 @@ where
|
|||||||
let mut alts = alts.into_iter().map(Self::from_tree);
|
let mut alts = alts.into_iter().map(Self::from_tree);
|
||||||
let mut nfa = alts.next().ok_or(Uninhabited)??;
|
let mut nfa = alts.next().ok_or(Uninhabited)??;
|
||||||
for alt in alts {
|
for alt in alts {
|
||||||
nfa = nfa.union(&alt?);
|
nfa = nfa.union(alt?);
|
||||||
}
|
}
|
||||||
nfa
|
nfa
|
||||||
}
|
}
|
||||||
@ -136,7 +136,7 @@ where
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Compute the union of two `Nfa`s.
|
/// 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 start = self.start;
|
||||||
let accepting = self.accepting;
|
let accepting = self.accepting;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user