From 4b67fd502770c680aef7e29d065ae289cefe3dc0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philipp=20Kr=C3=BCger?= Date: Wed, 14 Feb 2024 17:37:29 +0100 Subject: [PATCH] chore: Fix nightly warning --- wnfs-common/src/metadata.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/wnfs-common/src/metadata.rs b/wnfs-common/src/metadata.rs index 8325821b..b20d9291 100644 --- a/wnfs-common/src/metadata.rs +++ b/wnfs-common/src/metadata.rs @@ -7,7 +7,7 @@ use serde::{ de::{DeserializeOwned, Error as DeError}, Deserialize, Deserializer, Serialize, Serializer, }; -use std::{collections::BTreeMap, convert::TryInto}; +use std::{collections::BTreeMap, convert::TryInto, fmt::Display}; //-------------------------------------------------------------------------------------------------- // Type Definitions @@ -24,17 +24,16 @@ pub enum NodeType { SnapshotSharePointer, } -impl ToString for NodeType { - fn to_string(&self) -> String { - match self { +impl Display for NodeType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(match self { NodeType::PublicFile => "wnfs/pub/file", NodeType::PublicDirectory => "wnfs/pub/dir", NodeType::PrivateFile => "wnfs/priv/file", NodeType::PrivateDirectory => "wnfs/priv/dir", NodeType::TemporalSharePointer => "wnfs/share/temporal", NodeType::SnapshotSharePointer => "wnfs/share/snapshot", - } - .to_string() + }) } }