Merge pull request #2848 from fitzgen/map-or-in-table-element-into-raw

Use `map_or` instead of `map` and `unwrap_or` in `TableElement::into_raw`
This commit is contained in:
Nick Fitzgerald
2021-04-19 15:45:12 -07:00
committed by GitHub

View File

@@ -71,7 +71,7 @@ impl TableElement {
unsafe fn into_raw(self) -> *mut u8 { unsafe fn into_raw(self) -> *mut u8 {
match self { match self {
Self::FuncRef(e) => e as _, Self::FuncRef(e) => e as _,
Self::ExternRef(e) => e.map(|e| e.into_raw()).unwrap_or(ptr::null_mut()), Self::ExternRef(e) => e.map_or(ptr::null_mut(), |e| e.into_raw()),
} }
} }
} }