changed match to 'matches!' (#31850)

This commit is contained in:
Aarya Khandelwal 2024-03-25 16:58:12 +05:30 committed by GitHub
parent 9a76dd9325
commit bd39e03eeb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
29 changed files with 185 additions and 229 deletions

View file

@ -136,11 +136,11 @@ impl EventListenerType {
owner: &EventTarget,
ty: &Atom,
) -> Option<CompiledEventListener> {
match self {
&mut EventListenerType::Inline(ref mut inline) => inline
match *self {
EventListenerType::Inline(ref mut inline) => inline
.get_compiled_handler(owner, ty)
.map(CompiledEventListener::Handler),
&mut EventListenerType::Additive(ref listener) => {
EventListenerType::Additive(ref listener) => {
Some(CompiledEventListener::Listener(listener.clone()))
},
}
@ -415,10 +415,9 @@ impl EventTarget {
Vacant(entry) => entry.insert(EventListeners(vec![])),
};
let idx = entries.iter().position(|ref entry| match entry.listener {
EventListenerType::Inline(_) => true,
_ => false,
});
let idx = entries
.iter()
.position(|ref entry| matches!(entry.listener, EventListenerType::Inline(_)));
match idx {
Some(idx) => match listener {