Make clippy happy <3

This commit is contained in:
Ellie Huxtable 2023-04-10 20:46:14 +01:00
parent 242b795e8e
commit 4393a5075b
6 changed files with 8 additions and 18 deletions

View File

@ -159,7 +159,7 @@ fn print_list_with<'h>(
}; };
for h in h.rev() { for h in h.rev() {
writeln!(w, "{}", fmt.with_args(&FmtHistory(&h))).expect("failed to write history"); writeln!(w, "{}", fmt.with_args(&FmtHistory(h))).expect("failed to write history");
} }
} }
@ -192,6 +192,7 @@ pub fn print_cmd_only<'h>(w: &mut StdoutLock, h: impl DoubleEndedIterator<Item =
} }
impl Cmd { impl Cmd {
#[allow(clippy::too_many_lines)]
pub async fn run(&self, settings: &Settings, db: &mut impl Database) -> Result<()> { pub async fn run(&self, settings: &Settings, db: &mut impl Database) -> Result<()> {
let context = current_context(); let context = current_context();

View File

@ -5,7 +5,6 @@ use eyre::Result;
use atuin_client::{ use atuin_client::{
database::Database, database::Database,
database::{current_context, OptFilters}, database::{current_context, OptFilters},
history::History,
result::HistoryResult, result::HistoryResult,
settings::{FilterMode, SearchMode, Settings}, settings::{FilterMode, SearchMode, Settings},
}; };

View File

@ -1,7 +1,6 @@
use async_trait::async_trait; use async_trait::async_trait;
use atuin_client::{ use atuin_client::{
database::{Context, Database}, database::{Context, Database},
history::History,
result::HistoryResult, result::HistoryResult,
settings::{FilterMode, SearchMode}, settings::{FilterMode, SearchMode},
}; };

View File

@ -1,7 +1,6 @@
use async_trait::async_trait; use async_trait::async_trait;
use atuin_client::{ use atuin_client::{
database::Database, database::OptFilters, history::History, result::HistoryResult, database::Database, database::OptFilters, result::HistoryResult, settings::SearchMode,
settings::SearchMode,
}; };
use eyre::Result; use eyre::Result;

View File

@ -1,9 +1,7 @@
use std::path::Path; use std::path::Path;
use async_trait::async_trait; use async_trait::async_trait;
use atuin_client::{ use atuin_client::{database::Database, result::HistoryResult, settings::FilterMode};
database::Database, history::History, result::HistoryResult, settings::FilterMode,
};
use chrono::Utc; use chrono::Utc;
use eyre::Result; use eyre::Result;
use fuzzy_matcher::{skim::SkimMatcherV2, FuzzyMatcher}; use fuzzy_matcher::{skim::SkimMatcherV2, FuzzyMatcher};

View File

@ -14,7 +14,6 @@ use unicode_width::UnicodeWidthStr;
use atuin_client::{ use atuin_client::{
database::{current_context, Database}, database::{current_context, Database},
history::History,
result::HistoryResult, result::HistoryResult,
settings::{ExitMode, FilterMode, SearchMode, Settings}, settings::{ExitMode, FilterMode, SearchMode, Settings},
}; };
@ -308,9 +307,9 @@ impl State {
let preview = self.build_preview(results, compact, preview_width, chunks[3].width.into()); let preview = self.build_preview(results, compact, preview_width, chunks[3].width.into());
f.render_widget(preview, chunks[3]); f.render_widget(preview, chunks[3]);
if results.len() > 0 { if !results.is_empty() {
let selected_history = results[self.results_state.selected()].clone(); let selected_history = results[self.results_state.selected()].clone();
self.render_bar(f, &selected_history, chunks[4]); Self::render_bar(f, &selected_history, chunks[4]);
} }
let extra_width = UnicodeWidthStr::width(self.search.input.substring()); let extra_width = UnicodeWidthStr::width(self.search.input.substring());
@ -374,18 +373,13 @@ impl State {
results_list results_list
} }
fn render_bar<T: Backend>( fn render_bar<T: Backend>(f: &mut Frame<'_, T>, history: &HistoryResult, chunk: Rect) {
&mut self,
f: &mut Frame<'_, T>,
history: &HistoryResult,
chunk: Rect,
) {
let bar = Layout::default() let bar = Layout::default()
.direction(Direction::Horizontal) .direction(Direction::Horizontal)
.constraints([Constraint::Ratio(9, 10), Constraint::Ratio(1, 10)].as_ref()) .constraints([Constraint::Ratio(9, 10), Constraint::Ratio(1, 10)].as_ref())
.split(chunk); .split(chunk);
let directory = Paragraph::new(Text::from(Span::raw(format!("{}", history.history.cwd,)))) let directory = Paragraph::new(Text::from(Span::raw(history.history.cwd.to_string())))
.style(Style::default().bg(Color::White).fg(Color::Black)); .style(Style::default().bg(Color::White).fg(Color::Black));
let count = Paragraph::new(Text::from(Span::raw(format!("x{}", history.count,)))) let count = Paragraph::new(Text::from(Span::raw(format!("x{}", history.count,))))