clippy: Fix manual_map warnings (#31922)

This commit is contained in:
Oluwatobi Sofela 2024-03-28 16:58:36 +01:00 committed by GitHub
parent 5d518ca8dc
commit 7349ce5b6a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 34 additions and 51 deletions

View file

@ -1941,10 +1941,12 @@ impl HTMLMediaElement {
}
pub fn get_current_frame(&self) -> Option<VideoFrame> {
match self.video_renderer.lock().unwrap().current_frame_holder {
Some(ref holder) => Some(holder.get_frame()),
None => None,
}
self.video_renderer
.lock()
.unwrap()
.current_frame_holder
.as_ref()
.map(|holder| holder.get_frame())
}
/// By default the audio is rendered through the audio sink automatically
@ -2088,15 +2090,14 @@ impl HTMLMediaElementMethods for HTMLMediaElement {
// https://html.spec.whatwg.org/multipage/#dom-media-srcobject
fn GetSrcObject(&self) -> Option<MediaStreamOrBlob> {
match *self.src_object.borrow() {
Some(ref src_object) => Some(match src_object {
(*self.src_object.borrow())
.as_ref()
.map(|src_object| match src_object {
SrcObject::Blob(blob) => MediaStreamOrBlob::Blob(DomRoot::from_ref(blob)),
SrcObject::MediaStream(stream) => {
MediaStreamOrBlob::MediaStream(DomRoot::from_ref(stream))
},
}),
None => None,
}
})
}
// https://html.spec.whatwg.org/multipage/#dom-media-srcobject
@ -2659,10 +2660,10 @@ impl FetchResponseListener for HTMLMediaElementFetchListener {
let content_length =
if let Some(content_range) = headers.typed_get::<ContentRange>() {
content_range.bytes_len()
} else if let Some(content_length) = headers.typed_get::<ContentLength>() {
Some(content_length.0)
} else {
None
headers
.typed_get::<ContentLength>()
.map(|content_length| content_length.0)
};
// We only set the expected input size if it changes.