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

@ -1123,8 +1123,8 @@ impl XMLHttpRequest {
unsafe fn arraybuffer_response(&self, cx: *mut JSContext) -> Option<NonNull<JSObject>> {
// Step 1
let created = self.response_arraybuffer.get();
if !created.is_null() {
return Some(NonNull::new_unchecked(created));
if let Some(nonnull) = NonNull::new(created) {
return Some(nonnull)
}
// Step 2