Clippy suggestions

This commit is contained in:
Marco De Araujo 2026-01-19 06:28:25 -04:00
parent 00cb8f7a9b
commit c48a37d56a
5 changed files with 22 additions and 22 deletions

View file

@ -159,7 +159,7 @@ impl App {
let seconds_until_update = self
.update_interval
.checked_sub(self.last_update.elapsed())
.map(|d| d.as_secs() as u64)
.map(|d| d.as_secs())
.unwrap_or(30);
render_footer(frame, chunks[2], seconds_until_update);
@ -198,20 +198,20 @@ impl App {
fn handle_events(&mut self) -> io::Result<()> {
let timeout = Duration::from_secs(1);
if event::poll(timeout)? {
if let Event::Key(key) = event::read()? {
if key.kind == KeyEventKind::Release {
return Ok(());
}
if event::poll(timeout)?
&& let Event::Key(key) = event::read()?
{
if key.kind == KeyEventKind::Release {
return Ok(());
}
match key.code {
KeyCode::Char('q') | KeyCode::Esc => self.should_quit = true,
KeyCode::Up | KeyCode::Char('k') => self.state.scroll_state.prev(),
KeyCode::Down | KeyCode::Char('j') => self.state.scroll_state.next(),
KeyCode::Home => self.state.scroll_state.first(),
KeyCode::End => self.state.scroll_state.last(),
_ => {}
}
match key.code {
KeyCode::Char('q') | KeyCode::Esc => self.should_quit = true,
KeyCode::Up | KeyCode::Char('k') => self.state.scroll_state.prev(),
KeyCode::Down | KeyCode::Char('j') => self.state.scroll_state.next(),
KeyCode::Home => self.state.scroll_state.first(),
KeyCode::End => self.state.scroll_state.last(),
_ => {}
}
}
Ok(())

View file

@ -38,7 +38,7 @@ pub fn render_monitor_list(main_frame: &mut Frame, area: Rect, state: &mut Dashb
let mut lines_skipped = 0;
let half = state.get_total_lenght().saturating_div(2);
for (_i, group) in state.groups.iter().enumerate() {
for group in state.groups.iter() {
let group_height = group.monitors.len() + BORDER_LINES_VIEW;
if lines_skipped + group_height <= scroll_pos {
@ -103,7 +103,7 @@ fn render_group(frame: &mut Frame, area: Rect, group: &GroupViewState, is_first_
fn render_monitor_table(
frame: &mut Frame,
area: Rect,
monitors: &Vec<MonitorViewState>,
monitors: &[MonitorViewState],
is_first_half: bool,
) {
let max_items = area.height as usize;

View file

@ -120,7 +120,7 @@ fn add_monitor_view_state(group: UnifiedGroupData) -> Vec<MonitorViewState> {
.monitors
.into_par_iter()
.map(|monitor| {
let status_history = get_status_history(&monitor.heartbeats);
let status_history = get_status_history(monitor.heartbeats);
let status = match monitor.heartbeats.last().map(|h| h.status) {
Some(1) => MonitorStatus::Up,