From 63f54d234f0d622d043dca8176f0715889a6ed48 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Thu, 27 Dec 2018 21:02:08 +0300 Subject: dont leak Name details in testing --- crates/ra_hir/src/name.rs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'crates/ra_hir/src/name.rs') diff --git a/crates/ra_hir/src/name.rs b/crates/ra_hir/src/name.rs index cdad31be7..e4fc141a6 100644 --- a/crates/ra_hir/src/name.rs +++ b/crates/ra_hir/src/name.rs @@ -5,7 +5,7 @@ use ra_syntax::{ast, SmolStr}; /// `Name` is a wrapper around string, which is used in hir for both references /// and declarations. In theory, names should also carry hygene info, but we are /// not there yet! -#[derive(Debug, Clone, PartialEq, Eq, Hash)] +#[derive(Clone, PartialEq, Eq, Hash)] pub struct Name { text: SmolStr, } @@ -16,6 +16,12 @@ impl fmt::Display for Name { } } +impl fmt::Debug for Name { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { + fmt::Debug::fmt(&self.text, f) + } +} + impl Name { pub(crate) fn as_known_name(&self) -> Option { let name = match self.text.as_str() { @@ -38,15 +44,9 @@ impl Name { Some(name) } - #[cfg(not(test))] fn new(text: SmolStr) -> Name { Name { text } } - - #[cfg(test)] - pub(crate) fn new(text: SmolStr) -> Name { - Name { text } - } } pub(crate) trait AsName { -- cgit v1.2.3