clippy: Fix some warnings in script/dom (#31915)

* fixed some clippy warnings

* resolved conflict

* updated texttracklist.rs

---------

Co-authored-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
Ekta Siwach 2024-03-28 22:27:25 +05:30 committed by GitHub
parent 9303c90159
commit 7ce78f5a74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 9 deletions

View file

@ -142,7 +142,7 @@ impl TextTrackMethods for TextTrack {
// gecko calls RemoveCue when the given cue
// has an associated track, but doesn't return
// the error from it, so we wont either.
if let Err(_) = old_track.RemoveCue(cue) {
if old_track.RemoveCue(cue).is_err() {
warn!("Failed to remove cues for the added cue's text track");
}
}

View file

@ -42,8 +42,7 @@ impl TextTrackCueList {
.borrow()
.iter()
.enumerate()
.filter(|(_, c)| **c == cue)
.next()
.find(|(_, c)| **c == cue)
.map(|(i, _)| i)
}
@ -78,8 +77,7 @@ impl TextTrackCueListMethods for TextTrackCueList {
self.dom_cues
.borrow()
.iter()
.filter(|cue| cue.id() == id)
.next()
.find(|cue| cue.id() == id)
.map(|t| DomRoot::from_ref(&**t))
}
}

View file

@ -49,8 +49,7 @@ impl TextTrackList {
.borrow()
.iter()
.enumerate()
.filter(|(_, t)| **t == track)
.next()
.find(|(_, t)| **t == track)
.map(|(i, _)| i)
}
@ -125,8 +124,7 @@ impl TextTrackListMethods for TextTrackList {
self.dom_tracks
.borrow()
.iter()
.filter(|track| track.id() == id_str)
.next()
.find(|track| track.id() == id_str)
.map(|t| DomRoot::from_ref(&**t))
}