mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 13:48:50 +00:00
Make Debug less verbose for VfsPath and use Display in analysis-stats
This commit is contained in:
parent
dff62def2e
commit
c15c22139f
2 changed files with 18 additions and 3 deletions
|
@ -121,7 +121,7 @@ pub fn analysis_stats(
|
||||||
let original_file = src.file_id.original_file(db);
|
let original_file = src.file_id.original_file(db);
|
||||||
let path = vfs.file_path(original_file);
|
let path = vfs.file_path(original_file);
|
||||||
let syntax_range = src.value.syntax().text_range();
|
let syntax_range = src.value.syntax().text_range();
|
||||||
format_to!(msg, " ({:?} {:?})", path, syntax_range);
|
format_to!(msg, " ({} {:?})", path, syntax_range);
|
||||||
}
|
}
|
||||||
if verbosity.is_spammy() {
|
if verbosity.is_spammy() {
|
||||||
bar.println(msg.to_string());
|
bar.println(msg.to_string());
|
||||||
|
|
|
@ -5,7 +5,7 @@ use paths::{AbsPath, AbsPathBuf};
|
||||||
|
|
||||||
/// Long-term, we want to support files which do not reside in the file-system,
|
/// Long-term, we want to support files which do not reside in the file-system,
|
||||||
/// so we treat VfsPaths as opaque identifiers.
|
/// 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);
|
pub struct VfsPath(VfsPathRepr);
|
||||||
|
|
||||||
impl VfsPath {
|
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 {
|
enum VfsPathRepr {
|
||||||
PathBuf(AbsPathBuf),
|
PathBuf(AbsPathBuf),
|
||||||
VirtualPath(VirtualPath),
|
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)]
|
#[derive(Debug, Clone, Ord, PartialOrd, Eq, PartialEq, Hash)]
|
||||||
struct VirtualPath(String);
|
struct VirtualPath(String);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue