mirror of
https://github.com/servo/servo.git
synced 2025-06-19 14:48:59 +01:00
Auto merge of #9436 - fstr:issue-9403, r=KiChjang
Use .find().map() instead of .filter_map().next() Patch for issue #9403 <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9436) <!-- Reviewable:end -->
This commit is contained in:
commit
562fe03e80
1 changed files with 2 additions and 7 deletions
|
@ -78,13 +78,8 @@ impl URLSearchParamsMethods for URLSearchParams {
|
||||||
// https://url.spec.whatwg.org/#dom-urlsearchparams-get
|
// https://url.spec.whatwg.org/#dom-urlsearchparams-get
|
||||||
fn Get(&self, name: USVString) -> Option<USVString> {
|
fn Get(&self, name: USVString) -> Option<USVString> {
|
||||||
let list = self.list.borrow();
|
let list = self.list.borrow();
|
||||||
list.iter().filter_map(|&(ref k, ref v)| {
|
list.iter().find(|&kv| kv.0 == name.0)
|
||||||
if k == &name.0 {
|
.map(|ref kv| USVString(kv.1.clone()))
|
||||||
Some(USVString(v.clone()))
|
|
||||||
} else {
|
|
||||||
None
|
|
||||||
}
|
|
||||||
}).next()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#dom-urlsearchparams-getall
|
// https://url.spec.whatwg.org/#dom-urlsearchparams-getall
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue