diff options
author | Aleksey Kladov <[email protected]> | 2019-04-22 13:56:28 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-04-22 13:56:28 +0100 |
commit | e01052d1f0b8bf70a418a10538528923c5f400d5 (patch) | |
tree | 18ed1c151e7782b791214df4c4a2966c617ae1c6 /crates/ra_hir/src/name.rs | |
parent | 200032852be0c66b978c875a8edf0eca1f08b901 (diff) |
move auto-imoprter into IDE
auto-import is purely an IDE concern, so it should be done outside of
HIR
Diffstat (limited to 'crates/ra_hir/src/name.rs')
-rw-r--r-- | crates/ra_hir/src/name.rs | 13 |
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> { |