aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/rust-analyzer/src/cli/analysis_stats.rs2
-rw-r--r--crates/vfs/src/vfs_path.rs19
2 files changed, 18 insertions, 3 deletions
diff --git a/crates/rust-analyzer/src/cli/analysis_stats.rs b/crates/rust-analyzer/src/cli/analysis_stats.rs
index 90868760b..2f4c29e06 100644
--- a/crates/rust-analyzer/src/cli/analysis_stats.rs
+++ b/crates/rust-analyzer/src/cli/analysis_stats.rs
@@ -121,7 +121,7 @@ pub fn analysis_stats(
121 let original_file = src.file_id.original_file(db); 121 let original_file = src.file_id.original_file(db);
122 let path = vfs.file_path(original_file); 122 let path = vfs.file_path(original_file);
123 let syntax_range = src.value.syntax().text_range(); 123 let syntax_range = src.value.syntax().text_range();
124 format_to!(msg, " ({:?} {:?})", path, syntax_range); 124 format_to!(msg, " ({} {:?})", path, syntax_range);
125 } 125 }
126 if verbosity.is_spammy() { 126 if verbosity.is_spammy() {
127 bar.println(msg.to_string()); 127 bar.println(msg.to_string());
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};
5 5
6/// Long-term, we want to support files which do not reside in the file-system, 6/// Long-term, we want to support files which do not reside in the file-system,
7/// so we treat VfsPaths as opaque identifiers. 7/// so we treat VfsPaths as opaque identifiers.
8#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] 8#[derive(Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
9pub struct VfsPath(VfsPathRepr); 9pub struct VfsPath(VfsPathRepr);
10 10
11impl VfsPath { 11impl VfsPath {
@@ -50,7 +50,7 @@ impl VfsPath {
50 } 50 }
51} 51}
52 52
53#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] 53#[derive(Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
54enum VfsPathRepr { 54enum VfsPathRepr {
55 PathBuf(AbsPathBuf), 55 PathBuf(AbsPathBuf),
56 VirtualPath(VirtualPath), 56 VirtualPath(VirtualPath),
@@ -71,6 +71,21 @@ impl fmt::Display for VfsPath {
71 } 71 }
72} 72}
73 73
74impl fmt::Debug for VfsPath {
75 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
76 fmt::Debug::fmt(&self.0, f)
77 }
78}
79
80impl fmt::Debug for VfsPathRepr {
81 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
82 match &self {
83 VfsPathRepr::PathBuf(it) => fmt::Debug::fmt(&it.display(), f),
84 VfsPathRepr::VirtualPath(VirtualPath(it)) => fmt::Debug::fmt(&it, f),
85 }
86 }
87}
88
74#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)] 89#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
75struct VirtualPath(String); 90struct VirtualPath(String);
76 91