fix: resolve all 23 clippy warnings
Some checks failed
ci/woodpecker/pr/check Pipeline failed
CI / Check (pull_request) Has been cancelled
CI / Format (pull_request) Has been cancelled
CI / Clippy (pull_request) Has been cancelled
CI / Build (macos-latest) (pull_request) Has been cancelled
CI / Build (ubuntu-latest) (pull_request) Has been cancelled
CI / Build (windows-latest) (pull_request) Has been cancelled
Some checks failed
ci/woodpecker/pr/check Pipeline failed
CI / Check (pull_request) Has been cancelled
CI / Format (pull_request) Has been cancelled
CI / Clippy (pull_request) Has been cancelled
CI / Build (macos-latest) (pull_request) Has been cancelled
CI / Build (ubuntu-latest) (pull_request) Has been cancelled
CI / Build (windows-latest) (pull_request) Has been cancelled
This commit is contained in:
@@ -110,8 +110,19 @@ pub struct Keybindings {
|
||||
}
|
||||
|
||||
impl Keybindings {
|
||||
/// Создаёт дефолтную конфигурацию
|
||||
pub fn default() -> Self {
|
||||
/// Ищет команду по клавише
|
||||
pub fn get_command(&self, event: &KeyEvent) -> Option<Command> {
|
||||
for (command, bindings) in &self.bindings {
|
||||
if bindings.iter().any(|binding| binding.matches(event)) {
|
||||
return Some(*command);
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Keybindings {
|
||||
fn default() -> Self {
|
||||
let mut bindings = HashMap::new();
|
||||
|
||||
// Navigation
|
||||
@@ -301,22 +312,6 @@ impl Keybindings {
|
||||
|
||||
Self { bindings }
|
||||
}
|
||||
|
||||
/// Ищет команду по клавише
|
||||
pub fn get_command(&self, event: &KeyEvent) -> Option<Command> {
|
||||
for (command, bindings) in &self.bindings {
|
||||
if bindings.iter().any(|binding| binding.matches(event)) {
|
||||
return Some(*command);
|
||||
}
|
||||
}
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for Keybindings {
|
||||
fn default() -> Self {
|
||||
Self::default()
|
||||
}
|
||||
}
|
||||
|
||||
/// Сериализация KeyModifiers
|
||||
@@ -428,8 +423,8 @@ mod key_code_serde {
|
||||
return Ok(KeyCode::Char(c));
|
||||
}
|
||||
|
||||
if s.starts_with("F") {
|
||||
let n = s[1..].parse().map_err(serde::de::Error::custom)?;
|
||||
if let Some(suffix) = s.strip_prefix("F") {
|
||||
let n = suffix.parse().map_err(serde::de::Error::custom)?;
|
||||
return Ok(KeyCode::F(n));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user