Prefer `Option` combinator over `match`.

This commit is contained in:
Corey Farwell 2017-04-27 00:32:38 -04:00
parent a6bca6a8a6
commit aa53e47dd8
1 changed files with 2 additions and 4 deletions

View File

@ -6,10 +6,8 @@ impl<T> UncheckedValue<Option<T>> for VALUE where VALUE: UncheckedValue<T> {
if unsafe { self == Qnil } {
Ok(unsafe { CheckedValue::new(self) })
} else {
match UncheckedValue::<T>::to_checked(self) {
Ok(_) => Ok(unsafe { CheckedValue::new(self) }),
Err(e) => Err(e)
}
UncheckedValue::<T>::to_checked(self)
.map(|_| unsafe { CheckedValue::new(self) })
}
}
}