Fix value_owned for ArcValue

This commit is contained in:
Tony Garnock-Jones 2021-10-02 11:49:40 +02:00
parent 55b02b9cff
commit 5260f85952
1 changed files with 4 additions and 1 deletions

View File

@ -1389,7 +1389,10 @@ impl<D: Embeddable> NestedValue for ArcValue<D> {
#[inline(always)]
fn value_owned(self) -> Value<Self> {
Arc::try_unwrap(self.0).unwrap_or_else(|_| panic!("value_owned on ArcValue with refcount greater than one")).1
match Arc::try_unwrap(self.0) {
Ok(AnnotatedValue(_anns, v)) => v,
Err(r) => r.1.clone(),
}
}
}