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> {
|
pub fn get_by_keycode(keycode: VirtualKeyCode, vars: &console::Vars) -> Option<Stevenkey> {
|
||||||
for steven_key in Stevenkey::values() {
|
Stevenkey::values()
|
||||||
if keycode as i64 == *vars.get(steven_key.get_cvar()) {
|
.into_iter()
|
||||||
return Some(steven_key);
|
.find(|steven_key| keycode as i64 == *vars.get(steven_key.get_cvar()))
|
||||||
}
|
|
||||||
}
|
|
||||||
None
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn get_cvar(&self) -> console::CVar<i64> {
|
pub fn get_cvar(&self) -> console::CVar<i64> {
|
||||||
|
|
Loading…
Reference in New Issue