aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2021-03-08 19:14:52 +0000
committerAleksey Kladov <[email protected]>2021-03-08 19:14:52 +0000
commit9faf8dd69a819e50b9c973857fe324d7605e2d24 (patch)
treea9eccedac7905ac3b6d6608b4607241ddefe6a63
parente346a9c5e1f5fb536df19086a52411cf05255ac9 (diff)
Hygiene is an internal implementation detail of the compiler
-rw-r--r--crates/hir/src/lib.rs7
-rw-r--r--crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs4
-rw-r--r--crates/ide_assists/src/handlers/qualify_path.rs6
-rw-r--r--docs/dev/architecture.md2
4 files changed, 12 insertions, 7 deletions
diff --git a/crates/hir/src/lib.rs b/crates/hir/src/lib.rs
index a38e20300..62692c2c1 100644
--- a/crates/hir/src/lib.rs
+++ b/crates/hir/src/lib.rs
@@ -96,7 +96,7 @@ pub use {
96 visibility::Visibility, 96 visibility::Visibility,
97 }, 97 },
98 hir_expand::{ 98 hir_expand::{
99 name::{known, AsName, Name}, 99 name::{known, Name},
100 ExpandResult, HirFileId, InFile, MacroCallId, MacroCallLoc, /* FIXME */ MacroDefId, 100 ExpandResult, HirFileId, InFile, MacroCallId, MacroCallLoc, /* FIXME */ MacroDefId,
101 MacroFile, Origin, 101 MacroFile, Origin,
102 }, 102 },
@@ -106,7 +106,10 @@ pub use {
106// These are negative re-exports: pub using these names is forbidden, they 106// These are negative re-exports: pub using these names is forbidden, they
107// should remain private to hir internals. 107// should remain private to hir internals.
108#[allow(unused)] 108#[allow(unused)]
109use {hir_def::path::Path, hir_expand::hygiene::Hygiene}; 109use {
110 hir_def::path::Path,
111 hir_expand::{hygiene::Hygiene, name::AsName},
112};
110 113
111/// hir::Crate describes a single crate. It's the main interface with which 114/// hir::Crate describes a single crate. It's the main interface with which
112/// a crate's dependencies interact. Mostly, it should be just a proxy for the 115/// a crate's dependencies interact. Mostly, it should be just a proxy for the
diff --git a/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs
index 4f0422e96..335e0ed95 100644
--- a/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs
+++ b/crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs
@@ -1,7 +1,7 @@
1use std::iter; 1use std::iter;
2 2
3use either::Either; 3use either::Either;
4use hir::{AsName, Module, ModuleDef, Name, Variant}; 4use hir::{Module, ModuleDef, Name, Variant};
5use ide_db::{ 5use ide_db::{
6 defs::Definition, 6 defs::Definition,
7 helpers::{ 7 helpers::{
@@ -133,7 +133,7 @@ fn existing_definition(db: &RootDatabase, variant_name: &ast::Name, variant: &Va
133 ), 133 ),
134 _ => false, 134 _ => false,
135 }) 135 })
136 .any(|(name, _)| name == variant_name.as_name()) 136 .any(|(name, _)| name.to_string() == variant_name.to_string())
137} 137}
138 138
139fn insert_import( 139fn insert_import(
diff --git a/crates/ide_assists/src/handlers/qualify_path.rs b/crates/ide_assists/src/handlers/qualify_path.rs
index b0b0d31b4..d84ca0e55 100644
--- a/crates/ide_assists/src/handlers/qualify_path.rs
+++ b/crates/ide_assists/src/handlers/qualify_path.rs
@@ -1,6 +1,6 @@
1use std::iter; 1use std::iter;
2 2
3use hir::{AsAssocItem, AsName}; 3use hir::AsAssocItem;
4use ide_db::helpers::{import_assets::ImportCandidate, mod_path_to_ast}; 4use ide_db::helpers::{import_assets::ImportCandidate, mod_path_to_ast};
5use ide_db::RootDatabase; 5use ide_db::RootDatabase;
6use syntax::{ 6use syntax::{
@@ -160,7 +160,9 @@ fn find_trait_method(
160) -> Option<hir::Function> { 160) -> Option<hir::Function> {
161 if let Some(hir::AssocItem::Function(method)) = 161 if let Some(hir::AssocItem::Function(method)) =
162 trait_.items(db).into_iter().find(|item: &hir::AssocItem| { 162 trait_.items(db).into_iter().find(|item: &hir::AssocItem| {
163 item.name(db).map(|name| name == trait_method_name.as_name()).unwrap_or(false) 163 item.name(db)
164 .map(|name| name.to_string() == trait_method_name.to_string())
165 .unwrap_or(false)
164 }) 166 })
165 { 167 {
166 Some(method) 168 Some(method)
diff --git a/docs/dev/architecture.md b/docs/dev/architecture.md
index 0a3fd4285..e2237ca95 100644
--- a/docs/dev/architecture.md
+++ b/docs/dev/architecture.md
@@ -46,7 +46,7 @@ This is *the* entry point, but it front-loads a lot of complexity, so its fine t
46 46
47`crates/rust-analyzer/src/handlers.rs` implements all LSP requests and is a great place to start if you are already familiar with LSP. 47`crates/rust-analyzer/src/handlers.rs` implements all LSP requests and is a great place to start if you are already familiar with LSP.
48 48
49`Analysis` and `AnalysisHost` types define the main API. 49`Analysis` and `AnalysisHost` types define the main API for consumers of IDE services.
50 50
51## Code Map 51## Code Map
52 52