fix clippy warnings

pull/20/head
Takayuki Maeda 3 years ago
parent 7008af9e62
commit fa03b83710

@ -29,11 +29,11 @@ impl DatabaseTreeItems {
if item.is_database() {
let mut item = item.clone();
item.set_collapsed(false);
item.clone()
item
} else {
let mut item = item.clone();
item.show();
item.clone()
item
}
})
.collect::<Vec<DatabaseTreeItem>>(),

@ -145,7 +145,7 @@ impl DatabaseTreeItem {
self.info.visible = false;
}
pub fn is_match(&self, filter_text: &String) -> bool {
pub fn is_match(&self, filter_text: &str) -> bool {
match self.kind.clone() {
DatabaseTreeItemKind::Database { name, .. } => name.contains(filter_text),
DatabaseTreeItemKind::Table { table, .. } => table.name.contains(filter_text),

@ -143,13 +143,10 @@ impl DatabasesComponent {
items.insert(
0,
Span::styled(
format!(
"{}",
(0..area.width as usize)
.map(|_| HORIZONTAL)
.collect::<Vec<&str>>()
.join("")
),
(0..area.width as usize)
.map(|_| HORIZONTAL)
.collect::<Vec<&str>>()
.join(""),
Style::default(),
),
);
@ -200,14 +197,12 @@ impl DatabasesComponent {
impl DrawableComponent for DatabasesComponent {
fn draw<B: Backend>(&mut self, f: &mut Frame<B>, area: Rect, focused: bool) -> Result<()> {
if true {
let chunks = Layout::default()
.direction(Direction::Horizontal)
.constraints([Constraint::Percentage(100)].as_ref())
.split(area);
let chunks = Layout::default()
.direction(Direction::Horizontal)
.constraints([Constraint::Percentage(100)].as_ref())
.split(area);
self.draw_tree(f, chunks[0], focused);
}
self.draw_tree(f, chunks[0], focused);
Ok(())
}
}
@ -262,7 +257,5 @@ impl Component for DatabasesComponent {
fn tree_nav(tree: &mut DatabaseTree, key: Key) {
if let Some(common_nav) = common_nav(key) {
tree.move_selection(common_nav);
} else {
false;
}
}

@ -49,7 +49,7 @@ impl DrawableComponent for ErrorComponent {
}
impl Component for ErrorComponent {
fn event(&mut self, key: Key) -> Result<()> {
fn event(&mut self, _key: Key) -> Result<()> {
Ok(())
}
}

@ -2,7 +2,7 @@ use crate::app::{App, FocusBlock};
use crate::components::Component as _;
use crate::event::Key;
use crate::utils::{get_databases, get_tables};
use database_tree::{Database, DatabaseTree};
use database_tree::Database;
use sqlx::mysql::MySqlPool;
use std::collections::BTreeSet;

@ -1,5 +1,4 @@
use crate::app::{App, FocusBlock};
use crate::components::databases::FocusBlock as DatabaseFocusBlock;
use crate::components::Component as _;
use crate::event::Key;
use crate::utils::{get_columns, get_records};

Loading…
Cancel
Save