mirror of
https://github.com/servo/servo.git
synced 2025-06-25 01:24:37 +01:00
auto merge of #2178 : Ms2ger/servo/enum-position, r=jdm
This is a shorter and probably slightly more efficient to write the loop.
This commit is contained in:
commit
ba9177b7cc
1 changed files with 2 additions and 2 deletions
|
@ -484,12 +484,12 @@ pub fn FindEnumStringIndex(cx: *JSContext,
|
|||
return Err(());
|
||||
}
|
||||
|
||||
Ok(values.iter().enumerate().find(|&(_, value)| {
|
||||
Ok(values.iter().position(|value| {
|
||||
value.len() == length as uint &&
|
||||
range(0, length as int).all(|j| {
|
||||
value[j] as u16 == *chars.offset(j)
|
||||
})
|
||||
}).map(|(i, _)| i))
|
||||
}))
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue