style: Make from_image_request infallible.

All callsites already assert, so moving the assertion into the method
should be fine. It is not expected to handle a null image value anyway.

Bug: 1461858
Reviewed-by: emilio
MozReview-Commit-ID: J8CA8m22eSv
This commit is contained in:
Xidorn Quan 2018-05-16 13:39:58 +10:00 committed by Emilio Cobos Álvarez
parent dc2aadd43a
commit 45a37503af
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
2 changed files with 5 additions and 12 deletions

View file

@ -4145,9 +4145,7 @@ fn static_assert() {
unsafe {
let ref gecko_image_request = *self.gecko.mListStyleImage.mRawPtr;
UrlOrNone::Url(ComputedImageUrl::from_image_request(
gecko_image_request
).expect("mListStyleImage could not convert to ComputedImageUrl"))
UrlOrNone::Url(ComputedImageUrl::from_image_request(gecko_image_request))
}
}
@ -5437,7 +5435,6 @@ clip-path
let url = unsafe {
let gecko_image_request = gecko_cursor_image.mImage.mRawPtr.as_ref().unwrap();
ComputedImageUrl::from_image_request(&gecko_image_request)
.expect("mCursorImages.mImage could not convert to ComputedImageUrl")
};
let hotspot =
@ -5713,7 +5710,6 @@ clip-path
&**gecko_content.mContent.mImage.as_ref();
ContentItem::Url(
ComputedImageUrl::from_image_request(gecko_image_request)
.expect("mContent could not convert to ComputedImageUrl")
)
}
},