diff --git a/libs/remote_storage/src/lib.rs b/libs/remote_storage/src/lib.rs index 55db91dc31..e89f60de7e 100644 --- a/libs/remote_storage/src/lib.rs +++ b/libs/remote_storage/src/lib.rs @@ -12,7 +12,7 @@ use std::{ borrow::Cow, collections::HashMap, ffi::OsStr, - fmt::Debug, + fmt::{Debug, Display}, num::{NonZeroU32, NonZeroUsize}, ops::Deref, path::{Path, PathBuf}, @@ -46,12 +46,6 @@ const REMOTE_STORAGE_PREFIX_SEPARATOR: char = '/'; #[derive(Clone, PartialEq, Eq)] pub struct RemoteObjectId(String); -impl From for String { - fn from(id: RemoteObjectId) -> Self { - id.0 - } -} - /// /// A key that refers to an object in remote storage. It works much like a Path, /// but it's a separate datatype so that you don't accidentally mix local paths @@ -80,7 +74,13 @@ impl RemoteObjectId { impl Debug for RemoteObjectId { fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> Result<(), std::fmt::Error> { - self.0.fmt(fmt) + Debug::fmt(&self.0, fmt) + } +} + +impl Display for RemoteObjectId { + fn fmt(&self, fmt: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + Display::fmt(&self.0, fmt) } } diff --git a/pageserver/src/storage_sync/download.rs b/pageserver/src/storage_sync/download.rs index 372ca0a463..b0beb4219a 100644 --- a/pageserver/src/storage_sync/download.rs +++ b/pageserver/src/storage_sync/download.rs @@ -625,7 +625,7 @@ mod tests { metadata_path(harness.conf, sync_id.timeline_id, sync_id.tenant_id) .with_file_name(IndexPart::FILE_NAME); let index_part_remote_id = local_storage.remote_object_id(&local_index_part_path)?; - let index_part_local_path = PathBuf::from(String::from(index_part_remote_id)); + let index_part_local_path = PathBuf::from(index_part_remote_id.to_string()); fs::create_dir_all(index_part_local_path.parent().unwrap()).await?; fs::write(&index_part_local_path, serde_json::to_vec(&index_part)?).await?;