style: format with clippy

This commit is contained in:
Даниил 2024-06-02 01:01:37 +04:00
parent 04a21c79f6
commit b234914d8b
Signed by: nm17
GPG key ID: 3303B70C59145CD4
10 changed files with 38 additions and 52 deletions

View file

@ -43,14 +43,14 @@ impl<'de> Deserialize<'de> for EpochUTC {
where
E: de::Error,
{
return Ok(Epoch::from_unix_seconds(v as f64).into());
Ok(Epoch::from_unix_seconds(v as f64).into())
}
fn visit_f64<E>(self, v: f64) -> Result<Self::Value, E>
where
E: de::Error,
{
return Ok(Epoch::from_unix_seconds(v).into());
Ok(Epoch::from_unix_seconds(v).into())
}
fn visit_str<E>(self, value: &str) -> Result<Self::Value, E>
@ -65,9 +65,9 @@ impl<'de> Deserialize<'de> for EpochUTC {
) as f64)
.into());
}
return Ok(
Ok(
Epoch::from_unix_seconds(value.parse().map_err(de::Error::custom)?).into(),
);
)
}
}

View file

@ -1,7 +1,6 @@
//! Глобальный модуль для вспомогательных типов и утилит.
//!
mod hifitime_serde;
use phf::phf_map;
@ -10,11 +9,11 @@ use std::borrow::Cow;
pub use hifitime_serde::EpochUTC;
/// Поддерживаемые типы.
///
/// TODO: Решить необходимо ли к данным прикреплять единицы измерения.
/// TODO: Сейчас вообще сомнительно оставлять ли это или нет.
#[allow(dead_code)]
#[derive(Debug, Clone, Hash, PartialEq, Eq)]
#[repr(u64)]
pub enum SupportedUnit {
@ -35,8 +34,8 @@ pub enum SupportedUnit {
impl Serialize for SupportedUnit {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
where
S: Serializer,
{
serializer.serialize_str(match self {
SupportedUnit::Celsius => "C",
@ -58,8 +57,8 @@ impl Serialize for SupportedUnit {
impl<'de> Deserialize<'de> for SupportedUnit {
fn deserialize<'a, D>(deserializer: D) -> Result<Self, D::Error>
where
D: Deserializer<'de>,
where
D: Deserializer<'de>,
{
let color_str = Cow::<'a, str>::deserialize(deserializer)?;
match STR_TO_UNITS.get(color_str.as_ref()) {