From 80b466efdf275688d04dbcd114046eafc8d0b366 Mon Sep 17 00:00:00 2001 From: "Christoph J. Scherr" Date: Fri, 26 Jul 2024 10:51:22 +0200 Subject: [PATCH] chore: address clippy findings --- src/clock.rs | 6 ++++++ src/clock/ui.rs | 2 ++ src/main.rs | 2 ++ 3 files changed, 10 insertions(+) diff --git a/src/clock.rs b/src/clock.rs index c8cdf92..922d2a8 100644 --- a/src/clock.rs +++ b/src/clock.rs @@ -1,5 +1,10 @@ #![warn(clippy::pedantic, clippy::style, clippy::nursery)] +// That's useful and sometimes I don't need extra stuff #![allow(clippy::question_mark_used)] +// allows us to cast u64 to i64, if the number is too high +// enough time has passed that I don't care +#![allow(clippy::cast_possible_wrap)] +#![allow(clippy::cast_sign_loss)] // it should only be positive anyway use chrono::{DateTime, Local, SubsecRound, Timelike}; use clap::Parser; @@ -257,6 +262,7 @@ impl Clock { fn on_tick(&mut self) { self.maybe_reset_since_zero(); } + #[allow(clippy::cast_possible_truncation)] // if we have that much padding, please truncate fn ui( &mut self, terminal: &mut Terminal>, diff --git a/src/clock/ui.rs b/src/clock/ui.rs index f13b98d..afa53e9 100644 --- a/src/clock/ui.rs +++ b/src/clock/ui.rs @@ -61,6 +61,8 @@ impl Data { #[must_use] #[inline] + #[allow(clippy::missing_const_for_fn)] // why should it be okay to make this const? This is + // a custom ringbuffer! pub fn now(&self) -> &DateTime { &self.now[self.idx] } diff --git a/src/main.rs b/src/main.rs index 0186fa2..3b04d7e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,5 @@ +#![allow(missing_docs)] // this is not a library crate + use std::io; use libpt::cli::clap::Parser;