Fix clippy::manual_find, replace with an iterator

This manual implementation of Iterator::find can be replaced with
`find`, which has the same performance, but Clippy considers easier to
read than the original implementation.
This commit is contained in:
ice_iix 2022-10-30 15:36:50 -07:00
parent 6394b60a39
commit e4c5e61857
1 changed files with 3 additions and 6 deletions

View File

@ -115,12 +115,9 @@ impl Stevenkey {
}
pub fn get_by_keycode(keycode: VirtualKeyCode, vars: &console::Vars) -> Option<Stevenkey> {
for steven_key in Stevenkey::values() {
if keycode as i64 == *vars.get(steven_key.get_cvar()) {
return Some(steven_key);
}
}
None
Stevenkey::values()
.into_iter()
.find(|steven_key| keycode as i64 == *vars.get(steven_key.get_cvar()))
}
pub fn get_cvar(&self) -> console::CVar<i64> {