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:
parent
6394b60a39
commit
e4c5e61857
|
@ -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> {
|
||||
|
|
Loading…
Reference in New Issue