fix clippy warnings

pull/3/head
Takayuki Maeda 3 years ago
parent 6c5a0069ba
commit f6155d6071

@ -229,10 +229,7 @@ impl App {
pub fn selected_database(&self) -> Option<&Database> {
match self.selected_database.selected() {
Some(i) => match self.databases.get(i) {
Some(db) => Some(db),
None => None,
},
Some(i) => self.databases.get(i),
None => None,
}
}

@ -20,9 +20,8 @@ pub async fn handle_app(key: Key, app: &mut App) -> anyhow::Result<()> {
record_table::handler(key, app, focused).await?
}
}
match key {
Key::Char('e') => app.input_mode = InputMode::Editing,
_ => (),
if let Key::Char('e') = key {
app.input_mode = InputMode::Editing
}
}
InputMode::Editing => match key {

@ -5,8 +5,8 @@ use crate::utils::get_records;
pub async fn handler(key: Key, app: &mut App, focused: bool) -> anyhow::Result<()> {
if focused {
match key {
Key::Char('j') => match app.selected_database.selected() {
Some(_) => {
Key::Char('j') => {
if app.selected_database.selected().is_some() {
app.record_table.column_index = 0;
app.next_table();
if let Some(database) = app.selected_database() {
@ -19,10 +19,9 @@ pub async fn handler(key: Key, app: &mut App, focused: bool) -> anyhow::Result<(
}
}
}
None => (),
},
Key::Char('k') => match app.selected_database.selected() {
Some(_) => {
}
Key::Char('k') => {
if app.selected_database.selected().is_some() {
app.record_table.column_index = 0;
app.previous_table();
if let Some(database) = app.selected_database() {
@ -35,8 +34,7 @@ pub async fn handler(key: Key, app: &mut App, focused: bool) -> anyhow::Result<(
}
}
}
None => (),
},
}
Key::Esc => app.focus_type = FocusBlock::TableList(false),
_ => (),
}

@ -68,7 +68,7 @@ pub fn convert_column_value_to_string(row: &MySqlRow, column: &MySqlColumn) -> S
}
Err(_) => "".to_string(),
},
"VARCHAR" | "CHAR" | "ENUM" => row.try_get(column_name).unwrap_or("".to_string()),
"VARCHAR" | "CHAR" | "ENUM" => row.try_get(column_name).unwrap_or_else(|_| "".to_string()),
"DATE" => match row.try_get(column_name) {
Ok(value) => {
let value: NaiveDate = value;

Loading…
Cancel
Save