aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_hir/src/name.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_hir/src/name.rs')
-rw-r--r--crates/ra_hir/src/name.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/crates/ra_hir/src/name.rs b/crates/ra_hir/src/name.rs
index 331da6027..9a999e66c 100644
--- a/crates/ra_hir/src/name.rs
+++ b/crates/ra_hir/src/name.rs
@@ -46,8 +46,17 @@ impl Name {
46 Name::new(idx.to_string().into()) 46 Name::new(idx.to_string().into())
47 } 47 }
48 48
49 pub fn to_smolstr(&self) -> SmolStr { 49 // There's should be no way to extract a string out of `Name`: `Name` in the
50 self.text.clone() 50 // future, `Name` will include hygiene information, and you can't encode
51 // hygiene into a String.
52 //
53 // If you need to compare something with `Name`, compare `Name`s directly.
54 //
55 // If you need to render `Name` for the user, use the `Display` impl, but be
56 // aware that it strips hygiene info.
57 #[deprecated(note = "use to_string instead")]
58 pub fn as_smolstr(&self) -> &SmolStr {
59 &self.text
51 } 60 }
52 61
53 pub(crate) fn as_known_name(&self) -> Option<KnownName> { 62 pub(crate) fn as_known_name(&self) -> Option<KnownName> {