Use safe NonZero constructor instead of an explicit null check

This commit is contained in:
Simon Sapin 2018-01-22 13:26:04 +01:00
parent 10ec5a2bb0
commit b78ac6ba6a
4 changed files with 6 additions and 10 deletions

View file

@ -160,7 +160,6 @@ impl ImageDataMethods for ImageData {
#[allow(unsafe_code)]
// https://html.spec.whatwg.org/multipage/#dom-imagedata-data
unsafe fn Data(&self, _: *mut JSContext) -> NonNull<JSObject> {
assert!(!self.data.get().is_null());
NonNull::new_unchecked(self.data.get())
NonNull::new(self.data.get()).expect("got a null pointer")
}
}