aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/domstringmap.rs
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2016-01-05 12:35:05 -0800
committerCorey Farwell <coreyf@rwell.org>2016-01-05 16:55:37 -0800
commit639fbc2275e947e8012c1307ff456011dcd81606 (patch)
tree5669b9be85e4293a8e0d85a1be88e41329d9adaa /components/script/dom/domstringmap.rs
parente3dd36f0f3cb894d0eacedc99134e715135882bf (diff)
downloadservo-639fbc2275e947e8012c1307ff456011dcd81606.tar.gz
servo-639fbc2275e947e8012c1307ff456011dcd81606.zip
Reduce 'match' body, remove unnecessary clone
Diffstat (limited to 'components/script/dom/domstringmap.rs')
-rw-r--r--components/script/dom/domstringmap.rs13
1 files changed, 3 insertions, 10 deletions
diff --git a/components/script/dom/domstringmap.rs b/components/script/dom/domstringmap.rs
index f33c39c5e47..713b8cc0368 100644
--- a/components/script/dom/domstringmap.rs
+++ b/components/script/dom/domstringmap.rs
@@ -48,16 +48,9 @@ impl DOMStringMapMethods for DOMStringMap {
// https://html.spec.whatwg.org/multipage/#dom-domstringmap-nameditem
fn NamedGetter(&self, name: DOMString, found: &mut bool) -> DOMString {
- match self.element.get_custom_attr(name) {
- Some(value) => {
- *found = true;
- value.clone()
- },
- None => {
- *found = false;
- DOMString::new()
- }
- }
+ let attr = self.element.get_custom_attr(name);
+ *found = attr.is_some();
+ attr.unwrap_or_default()
}
// https://html.spec.whatwg.org/multipage/#the-domstringmap-interface:supported-property-names