mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-23 02:27:39 +03: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:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user