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:
bors-servo 2014-04-19 11:01:15 -04:00
commit ba9177b7cc

View file

@ -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))
}))
}
}