Skip to content

Commit

Permalink
Use .find().map() instead of .filter_map().next() in URLSearchParams:…
Browse files Browse the repository at this point in the history
…:Get
  • Loading branch information
Florian Strübe committed Jan 26, 2016
1 parent d57ab5f commit 6fef891
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions components/script/dom/urlsearchparams.rs
Expand Up @@ -78,13 +78,7 @@ impl URLSearchParamsMethods for URLSearchParams {
// https://url.spec.whatwg.org/#dom-urlsearchparams-get
fn Get(&self, name: USVString) -> Option<USVString> {
let list = self.list.borrow();
list.iter().filter_map(|&(ref k, ref v)| {
if k == &name.0 {
Some(USVString(v.clone()))
} else {
None
}
}).next()
list.iter().find(|&&(ref k, _)| k == &name.0).map(|&(_, ref v)| USVString(v.clone()))
}

// https://url.spec.whatwg.org/#dom-urlsearchparams-getall
Expand Down

0 comments on commit 6fef891

Please sign in to comment.