Revert "chore: workspace global panic preventing lints (#5512)"

This reverts commit 6ac6747cc7.
This commit is contained in:
Jędrzej Stuczyński
2025-02-26 10:30:22 +00:00
committed by GitHub
parent 6ac6747cc7
commit 308de3a7cb
48 changed files with 77 additions and 221 deletions
-5
View File
@@ -125,8 +125,6 @@ impl TryFrom<i64> for Uptime {
impl From<Uptime> for Performance {
fn from(uptime: Uptime) -> Self {
// SAFETY: uptime has a valid range to be transformed into a `Performance`
#[allow(clippy::unwrap_used)]
Performance::from_percentage_value(uptime.0 as u64).unwrap()
}
}
@@ -483,9 +481,6 @@ pub enum NymApiStorageError {
// this one would never be returned to users since it's only possible on startup
#[error("failed to perform startup SQL migration - {0}")]
StartupMigrationFailure(#[from] sqlx::migrate::MigrateError),
#[error("{value} is not a valid unix timestamp")]
InvalidTimestampProvided { value: i64 },
}
impl From<sqlx::Error> for NymApiStorageError {
@@ -8,8 +8,7 @@ use crate::node_status_api::ONE_DAY;
use crate::storage::NymApiStorage;
use nym_task::{TaskClient, TaskManager};
use std::time::Duration;
use time::macros::time;
use time::{OffsetDateTime, PrimitiveDateTime};
use time::{OffsetDateTime, PrimitiveDateTime, Time};
use tokio::time::{interval_at, Instant};
use tracing::error;
use tracing::{info, trace, warn};
@@ -76,20 +75,18 @@ impl HistoricalUptimeUpdater {
// nodes update for different days
// the unwrap is fine as 23:00:00 is a valid time
let update_time = time!(23:00:00);
let update_time = Time::from_hms(23, 0, 0).unwrap();
let now = OffsetDateTime::now_utc();
// is the current time within 0:00 - 22:59:59 or 23:00 - 23:59:59 ?
let update_date = if now.hour() < 23 {
now.date()
} else {
// the unwrap is fine as (**PRESUMABLY**) we're not running this code in the year 9999
#[allow(clippy::unwrap_used)]
now.date().next_day().unwrap()
};
let update_datetime = PrimitiveDateTime::new(update_date, update_time).assume_utc();
// the unwrap here is fine as we're certain `update_datetime` is in the future and thus the
// resultant Duration is positive
#[allow(clippy::unwrap_used)]
let time_left: Duration = (update_datetime - now).try_into().unwrap();
info!(
-1
View File
@@ -109,7 +109,6 @@ impl NodeUptimes {
// the unwraps in Uptime::from_ratio are fine because it's impossible for us to have more "up" results
// than total test runs as we just bounded them
#[allow(clippy::unwrap_used)]
NodeUptimes {
most_recent: most_recent.try_into().unwrap(),
last_hour: Uptime::from_uptime_sum(last_hour_sum, last_hour_test_runs).unwrap(),