diff options
Diffstat (limited to 'crates/ra_hir')
-rw-r--r-- | crates/ra_hir/src/name.rs | 13 | ||||
-rw-r--r-- | crates/ra_hir/src/source_binder.rs | 2 |
2 files changed, 14 insertions, 1 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, |
diff --git a/crates/ra_hir/src/source_binder.rs b/crates/ra_hir/src/source_binder.rs index f1bb13bc6..2959e3eca 100644 --- a/crates/ra_hir/src/source_binder.rs +++ b/crates/ra_hir/src/source_binder.rs | |||
@@ -21,7 +21,7 @@ use crate::{ | |||
21 | AsName, Module, HirFileId, Crate, Trait, Resolver, Ty, | 21 | AsName, Module, HirFileId, Crate, Trait, Resolver, Ty, |
22 | expr::{BodySourceMap, scope::{ScopeId, ExprScopes}}, | 22 | expr::{BodySourceMap, scope::{ScopeId, ExprScopes}}, |
23 | ids::LocationCtx, | 23 | ids::LocationCtx, |
24 | expr, AstId | 24 | expr, AstId, |
25 | }; | 25 | }; |
26 | 26 | ||
27 | /// Locates the module by `FileId`. Picks topmost module in the file. | 27 | /// Locates the module by `FileId`. Picks topmost module in the file. |