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, 13 insertions, 0 deletions
diff --git a/crates/ra_hir/src/name.rs b/crates/ra_hir/src/name.rs
index 283f37845..9a999e66c 100644
--- a/crates/ra_hir/src/name.rs
+++ b/crates/ra_hir/src/name.rs
@@ -46,6 +46,19 @@ impl Name {
46 Name::new(idx.to_string().into()) 46 Name::new(idx.to_string().into())
47 } 47 }
48 48
49 // There's should be no way to extract a string out of `Name`: `Name` in the
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
60 }
61
49 pub(crate) fn as_known_name(&self) -> Option<KnownName> { 62 pub(crate) fn as_known_name(&self) -> Option<KnownName> {
50 let name = match self.text.as_str() { 63 let name = match self.text.as_str() {
51 "isize" => KnownName::Isize, 64 "isize" => KnownName::Isize,