aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/bindings
diff options
context:
space:
mode:
authorbors-servo <metajack+bors@gmail.com>2015-03-10 07:51:50 -0600
committerbors-servo <metajack+bors@gmail.com>2015-03-10 07:51:50 -0600
commitd31e80f89490afe4863574c062f34b2a0df43bae (patch)
tree98dadb54d54b2b8e4efd97a53ec76fefd02b0a08 /components/script/dom/bindings
parentfd1bb49a65dd998c8ef9890a1576aaf62ddfdba1 (diff)
parent08ac0766eda2340008642e86799ea2cb1ef6e59f (diff)
downloadservo-d31e80f89490afe4863574c062f34b2a0df43bae.tar.gz
servo-d31e80f89490afe4863574c062f34b2a0df43bae.zip
auto merge of #5182 : zslayton/servo/master, r=jdm
Opening this PR to invite feedback. Of the many `match` statement candidates for conversion to `if let`, several included `if` guards. Since `if let` doesn't support this syntax, I used nested if statements. If this is undesirable, say the word and I can revert those cases to `match`.
Diffstat (limited to 'components/script/dom/bindings')
-rw-r--r--components/script/dom/bindings/utils.rs34
1 files changed, 12 insertions, 22 deletions
diff --git a/components/script/dom/bindings/utils.rs b/components/script/dom/bindings/utils.rs
index 56c9b58288d..5dc48bd534a 100644
--- a/components/script/dom/bindings/utils.rs
+++ b/components/script/dom/bindings/utils.rs
@@ -224,23 +224,16 @@ fn create_interface_object(cx: *mut JSContext, global: *mut JSObject,
let constructor = JS_GetFunctionObject(fun);
assert!(!constructor.is_null());
- match members.static_methods {
- Some(static_methods) => {
- define_methods(cx, constructor, static_methods)
- },
- _ => (),
+ if let Some(static_methods) = members.static_methods {
+ define_methods(cx, constructor, static_methods);
}
- match members.static_attrs {
- Some(static_properties) => {
- define_properties(cx, constructor, static_properties)
- },
- _ => (),
+ if let Some(static_properties) = members.static_attrs {
+ define_properties(cx, constructor, static_properties);
}
- match members.consts {
- Some(constants) => define_constants(cx, constructor, constants),
- _ => (),
+ if let Some(constants) = members.consts {
+ define_constants(cx, constructor, constants);
}
if !proto.is_null() {
@@ -304,19 +297,16 @@ fn create_interface_prototype_object(cx: *mut JSContext, global: *mut JSObject,
&*parent_proto, &*global);
assert!(!our_proto.is_null());
- match members.methods {
- Some(methods) => define_methods(cx, our_proto, methods),
- _ => (),
+ if let Some(methods) = members.methods {
+ define_methods(cx, our_proto, methods);
}
- match members.attrs {
- Some(properties) => define_properties(cx, our_proto, properties),
- _ => (),
+ if let Some(properties) = members.attrs {
+ define_properties(cx, our_proto, properties);
}
- match members.consts {
- Some(constants) => define_constants(cx, our_proto, constants),
- _ => (),
+ if let Some(constants) = members.consts {
+ define_constants(cx, our_proto, constants);
}
return our_proto;