diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-22 14:19:47 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-04-22 14:19:47 +0100 |
commit | c416caeda2a09e84dc9cd201eff0bf04b701ae34 (patch) | |
tree | 81e9db6106e5201955bbf58a54aa51503e144ade /crates/ra_hir/src | |
parent | 6162278075df3d9e1d5ff77cf023dc2acaa6ee83 (diff) | |
parent | aa1ef6ae9a9a61ab6ddc42d7987753df3aa67263 (diff) |
Merge #1194
1194: Pr 1190 r=matklad a=matklad
Co-authored-by: Andrea Pretto <[email protected]>
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_hir/src')
-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. |