mirror of
https://github.com/chatmail/core.git
synced 2026-04-27 10:26:29 +03:00
Revert the change for EphermeralTimer, because clippy complains
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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};
|
||||
|
||||
Reference in New Issue
Block a user