Revert the change for EphermeralTimer, because clippy complains

This commit is contained in:
Hocuri
2026-04-26 10:35:59 +02:00
parent 7c60cdc51e
commit 04786f8851
2 changed files with 10 additions and 6 deletions

View File

@@ -66,6 +66,7 @@ use std::cmp::max;
use std::collections::BTreeSet;
use std::fmt;
use std::num::ParseIntError;
use std::str::FromStr;
use std::time::{Duration, UNIX_EPOCH};
use anyhow::{Context as _, Result, ensure};
@@ -123,12 +124,6 @@ impl Timer {
Self::Enabled { duration }
}
}
/// Tries to parse a string as an integer,
/// and converts it to an ephemeral timer value.
pub fn from_str(input: &str) -> Result<Timer, ParseIntError> {
input.parse::<u32>().map(Self::from_u32)
}
}
impl fmt::Display for Timer {
@@ -137,6 +132,14 @@ impl fmt::Display for Timer {
}
}
impl FromStr for Timer {
type Err = ParseIntError;
fn from_str(input: &str) -> Result<Timer, ParseIntError> {
input.parse::<u32>().map(Self::from_u32)
}
}
impl rusqlite::types::ToSql for Timer {
fn to_sql(&self) -> rusqlite::Result<rusqlite::types::ToSqlOutput<'_>> {
let val = rusqlite::types::Value::Integer(match self {

View File

@@ -3,6 +3,7 @@
use std::cmp;
use std::collections::{BTreeMap, BTreeSet};
use std::iter;
use std::str::FromStr as _;
use std::sync::LazyLock;
use anyhow::{Context as _, Result, ensure};