From c15c22139faacd41cc7e098a15aa6b820e0a20ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lauren=C8=9Biu=20Nicola?= Date: Wed, 24 Jun 2020 14:07:03 +0300 Subject: Make Debug less verbose for VfsPath and use Display in analysis-stats --- crates/vfs/src/vfs_path.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'crates/vfs') diff --git a/crates/vfs/src/vfs_path.rs b/crates/vfs/src/vfs_path.rs index 0a8a86c62..940f91d0e 100644 --- a/crates/vfs/src/vfs_path.rs +++ b/crates/vfs/src/vfs_path.rs @@ -5,7 +5,7 @@ use paths::{AbsPath, AbsPathBuf}; /// Long-term, we want to support files which do not reside in the file-system, /// so we treat VfsPaths as opaque identifiers. -#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] +#[derive(Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] pub struct VfsPath(VfsPathRepr); impl VfsPath { @@ -50,7 +50,7 @@ impl VfsPath { } } -#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] +#[derive(Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] enum VfsPathRepr { PathBuf(AbsPathBuf), VirtualPath(VirtualPath), @@ -71,6 +71,21 @@ impl fmt::Display for VfsPath { } } +impl fmt::Debug for VfsPath { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt::Debug::fmt(&self.0, f) + } +} + +impl fmt::Debug for VfsPathRepr { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + match &self { + VfsPathRepr::PathBuf(it) => fmt::Debug::fmt(&it.display(), f), + VfsPathRepr::VirtualPath(VirtualPath(it)) => fmt::Debug::fmt(&it, f), + } + } +} + #[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] struct VirtualPath(String); -- cgit v1.2.3