aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/rtcdatachannel.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/rtcdatachannel.rs')
-rw-r--r--components/script/dom/rtcdatachannel.rs19
1 files changed, 8 insertions, 11 deletions
diff --git a/components/script/dom/rtcdatachannel.rs b/components/script/dom/rtcdatachannel.rs
index 87429be677c..36c1cab92db 100644
--- a/components/script/dom/rtcdatachannel.rs
+++ b/components/script/dom/rtcdatachannel.rs
@@ -200,17 +200,14 @@ impl RTCDataChannel {
}
pub fn on_state_change(&self, state: DataChannelState) {
- match state {
- DataChannelState::Closing => {
- let event = Event::new(
- &self.global(),
- atom!("closing"),
- EventBubbles::DoesNotBubble,
- EventCancelable::NotCancelable,
- );
- event.upcast::<Event>().fire(self.upcast());
- },
- _ => {},
+ if let DataChannelState::Closing = state {
+ let event = Event::new(
+ &self.global(),
+ atom!("closing"),
+ EventBubbles::DoesNotBubble,
+ EventCancelable::NotCancelable,
+ );
+ event.upcast::<Event>().fire(self.upcast());
};
self.ready_state.set(state.into());
}