I don't want to suppress the warning unless I must, so I'm looking for a way to change the code so the warning will go away.
Any suggestions?
warning: unreachable pattern
Here's the code:
fn on_input(&mut self, inp: &Input) {
match inp {
Input::Button(but) => match but.state {
ButtonState::Press => match but.button {
Button::Keyboard(Key::Up) => self.up_d = true,
Button::Keyboard(Key::Down) => self.down_d = true,
Button::Keyboard(Key::Left) => self.left_d = true,
Button::Keyboard(Key::Right) => self.right_d = true,
_ => (),
},
ButtonState::Release => match but.button {
Button::Keyboard(Key::Up) => self.up_d = false,
Button::Keyboard(Key::Down) => self.down_d = false,
Button::Keyboard(Key::Left) => self.left_d = false,
Button::Keyboard(Key::Right) => self.right_d = false,
_ => (),
},
_ => {}, // WARNING HAPPENS ON THIS LINE
},
_ => {}
}
}