Fix clippy lints

This commit is contained in:
Alexandre Bury 2020-01-07 14:38:14 -08:00
parent d72584718b
commit 5e23c85f7a
2 changed files with 112 additions and 346 deletions

View File

@ -371,337 +371,103 @@ fn colour_to_blt_colour(clr: Color, role: ColorRole) -> BltColor {
BltColor::from_rgb(r, g, b) BltColor::from_rgb(r, g, b)
} }
#[allow(clippy::cognitive_complexity)]
fn blt_keycode_to_char(kc: KeyCode, shift: bool) -> char { fn blt_keycode_to_char(kc: KeyCode, shift: bool) -> char {
match kc { match kc {
KeyCode::A => { KeyCode::A if shift => 'A',
if shift { KeyCode::A => 'a',
'A' KeyCode::B if shift => 'B',
} else { KeyCode::B => 'b',
'a' KeyCode::C if shift => 'C',
} KeyCode::C => 'c',
} KeyCode::D if shift => 'D',
KeyCode::B => { KeyCode::D => 'd',
if shift { KeyCode::E if shift => 'E',
'B' KeyCode::E => 'e',
} else { KeyCode::F if shift => 'F',
'b' KeyCode::F => 'f',
} KeyCode::G if shift => 'G',
} KeyCode::G => 'g',
KeyCode::C => { KeyCode::H if shift => 'H',
if shift { KeyCode::H => 'h',
'C' KeyCode::I if shift => 'I',
} else { KeyCode::I => 'i',
'c' KeyCode::J if shift => 'J',
} KeyCode::J => 'j',
} KeyCode::K if shift => 'K',
KeyCode::D => { KeyCode::K => 'k',
if shift { KeyCode::L if shift => 'L',
'D' KeyCode::L => 'l',
} else { KeyCode::M if shift => 'M',
'd' KeyCode::M => 'm',
} KeyCode::N if shift => 'N',
} KeyCode::N => 'n',
KeyCode::E => { KeyCode::O if shift => 'O',
if shift { KeyCode::O => 'o',
'E' KeyCode::P if shift => 'P',
} else { KeyCode::P => 'p',
'e' KeyCode::Q if shift => 'Q',
} KeyCode::Q => 'q',
} KeyCode::R if shift => 'R',
KeyCode::F => { KeyCode::R => 'r',
if shift { KeyCode::S if shift => 'S',
'F' KeyCode::S => 's',
} else { KeyCode::T if shift => 'T',
'f' KeyCode::T => 't',
} KeyCode::U if shift => 'U',
} KeyCode::U => 'u',
KeyCode::G => { KeyCode::V if shift => 'V',
if shift { KeyCode::V => 'v',
'G' KeyCode::W if shift => 'W',
} else { KeyCode::W => 'w',
'g' KeyCode::X if shift => 'X',
} KeyCode::X => 'x',
} KeyCode::Y if shift => 'Y',
KeyCode::H => { KeyCode::Y => 'y',
if shift { KeyCode::Z if shift => 'Z',
'H' KeyCode::Z => 'z',
} else { KeyCode::Row1 if shift => '!',
'h' KeyCode::Row1 => '1',
} KeyCode::Row2 if shift => '@',
} KeyCode::Row2 => '2',
KeyCode::I => { KeyCode::Row3 if shift => '#',
if shift { KeyCode::Row3 => '3',
'I' KeyCode::Row4 if shift => '$',
} else { KeyCode::Row4 => '4',
'i' KeyCode::Row5 if shift => '%',
} KeyCode::Row5 => '5',
} KeyCode::Row6 if shift => '^',
KeyCode::J => { KeyCode::Row6 => '6',
if shift { KeyCode::Row7 if shift => '&',
'J' KeyCode::Row7 => '7',
} else { KeyCode::Row8 if shift => '*',
'j' KeyCode::Row8 => '8',
} KeyCode::Row9 if shift => '(',
} KeyCode::Row9 => '9',
KeyCode::K => { KeyCode::Row0 if shift => ')',
if shift { KeyCode::Row0 => '0',
'K' KeyCode::Grave if shift => '~',
} else { KeyCode::Grave => '`',
'k' KeyCode::Minus if shift => '_',
} KeyCode::Minus => '-',
} KeyCode::Equals if shift => '+',
KeyCode::L => { KeyCode::Equals => '=',
if shift { KeyCode::LeftBracket if shift => '{',
'L' KeyCode::LeftBracket => '[',
} else { KeyCode::RightBracket if shift => '}',
'l' KeyCode::RightBracket => ']',
} KeyCode::Backslash if shift => '|',
} KeyCode::Backspace => '\\',
KeyCode::M => { KeyCode::Semicolon if shift => ':',
if shift { KeyCode::Semicolon => ';',
'M' KeyCode::Apostrophe if shift => '"',
} else { KeyCode::Apostrophe => '\'',
'm' KeyCode::Comma if shift => '<',
} KeyCode::Comma => ',',
} KeyCode::Period if shift => '>',
KeyCode::N => { KeyCode::Period => '.',
if shift { KeyCode::Slash if shift => '?',
'N' KeyCode::Slash => '/',
} else {
'n'
}
}
KeyCode::O => {
if shift {
'O'
} else {
'o'
}
}
KeyCode::P => {
if shift {
'P'
} else {
'p'
}
}
KeyCode::Q => {
if shift {
'Q'
} else {
'q'
}
}
KeyCode::R => {
if shift {
'R'
} else {
'r'
}
}
KeyCode::S => {
if shift {
'S'
} else {
's'
}
}
KeyCode::T => {
if shift {
'T'
} else {
't'
}
}
KeyCode::U => {
if shift {
'U'
} else {
'u'
}
}
KeyCode::V => {
if shift {
'V'
} else {
'v'
}
}
KeyCode::W => {
if shift {
'W'
} else {
'w'
}
}
KeyCode::X => {
if shift {
'X'
} else {
'x'
}
}
KeyCode::Y => {
if shift {
'Y'
} else {
'y'
}
}
KeyCode::Z => {
if shift {
'Z'
} else {
'z'
}
}
KeyCode::Row1 => {
if shift {
'!'
} else {
'1'
}
}
KeyCode::Row2 => {
if shift {
'@'
} else {
'2'
}
}
KeyCode::Row3 => {
if shift {
'#'
} else {
'3'
}
}
KeyCode::Row4 => {
if shift {
'$'
} else {
'4'
}
}
KeyCode::Row5 => {
if shift {
'%'
} else {
'5'
}
}
KeyCode::Row6 => {
if shift {
'^'
} else {
'6'
}
}
KeyCode::Row7 => {
if shift {
'&'
} else {
'7'
}
}
KeyCode::Row8 => {
if shift {
'*'
} else {
'8'
}
}
KeyCode::Row9 => {
if shift {
'('
} else {
'9'
}
}
KeyCode::Row0 => {
if shift {
')'
} else {
'0'
}
}
KeyCode::Grave => {
if shift {
'~'
} else {
'`'
}
}
KeyCode::Minus => {
if shift {
'_'
} else {
'-'
}
}
KeyCode::Equals => {
if shift {
'+'
} else {
'='
}
}
KeyCode::LeftBracket => {
if shift {
'{'
} else {
'['
}
}
KeyCode::RightBracket => {
if shift {
'}'
} else {
']'
}
}
KeyCode::Backslash => {
if shift {
'|'
} else {
'\\'
}
}
KeyCode::Semicolon => {
if shift {
':'
} else {
';'
}
}
KeyCode::Apostrophe => {
if shift {
'"'
} else {
'\''
}
}
KeyCode::Comma => {
if shift {
'<'
} else {
','
}
}
KeyCode::Period => {
if shift {
'>'
} else {
'.'
}
}
KeyCode::Slash => {
if shift {
'?'
} else {
'/'
}
}
KeyCode::Space => ' ', KeyCode::Space => ' ',
KeyCode::NumDivide => '/', KeyCode::NumDivide => '/',
KeyCode::NumMultiply => '*', KeyCode::NumMultiply => '*',

View File

@ -122,26 +122,26 @@
//! //!
//! # Here we define the color palette. //! # Here we define the color palette.
//! [colors] //! [colors]
//! background = "black" //! background = "black"
//! # If the value is an array, the first valid color will be used. //! # If the value is an array, the first valid color will be used.
//! # If the terminal doesn't support custom color, //! # If the terminal doesn't support custom color,
//! # non-base colors will be skipped. //! # non-base colors will be skipped.
//! shadow = ["#000000", "black"] //! shadow = ["#000000", "black"]
//! view = "#d3d7cf" //! view = "#d3d7cf"
//! //!
//! # Array and simple values have the same effect. //! # Array and simple values have the same effect.
//! primary = ["#111111"] //! primary = ["#111111"]
//! secondary = "#EEEEEE" //! secondary = "#EEEEEE"
//! tertiary = "#444444" //! tertiary = "#444444"
//! //!
//! # Hex values can use lower or uppercase. //! # Hex values can use lower or uppercase.
//! # (base color MUST be lowercase) //! # (base color MUST be lowercase)
//! title_primary = "#ff5555" //! title_primary = "#ff5555"
//! title_secondary = "#ffff55" //! title_secondary = "#ffff55"
//! //!
//! # Lower precision values can use only 3 digits. //! # Lower precision values can use only 3 digits.
//! highlight = "#F00" //! highlight = "#F00"
//! highlight_inactive = "#5555FF" //! highlight_inactive = "#5555FF"
//! ``` //! ```
mod border_style; mod border_style;
mod color; mod color;