mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Use .find().map() instead of .filter_map().next() in URLSearchParams::Get
This commit is contained in:
parent
d57ab5f0c3
commit
6fef891ab8
1 changed files with 1 additions and 7 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue