Skip to content

Commit 9faf8dd

Browse files
committed
Hygiene is an internal implementation detail of the compiler
1 parent e346a9c commit 9faf8dd

File tree

4 files changed

+12
-7
lines changed

4 files changed

+12
-7
lines changed

crates/hir/src/lib.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ pub use {
9696
visibility::Visibility,
9797
},
9898
hir_expand::{
99-
name::{known, AsName, Name},
99+
name::{known, Name},
100100
ExpandResult, HirFileId, InFile, MacroCallId, MacroCallLoc, /* FIXME */ MacroDefId,
101101
MacroFile, Origin,
102102
},
@@ -106,7 +106,10 @@ pub use {
106106
// These are negative re-exports: pub using these names is forbidden, they
107107
// should remain private to hir internals.
108108
#[allow(unused)]
109-
use {hir_def::path::Path, hir_expand::hygiene::Hygiene};
109+
use {
110+
hir_def::path::Path,
111+
hir_expand::{hygiene::Hygiene, name::AsName},
112+
};
110113

111114
/// hir::Crate describes a single crate. It's the main interface with which
112115
/// a crate's dependencies interact. Mostly, it should be just a proxy for the

crates/ide_assists/src/handlers/extract_struct_from_enum_variant.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
use std::iter;
22

33
use either::Either;
4-
use hir::{AsName, Module, ModuleDef, Name, Variant};
4+
use hir::{Module, ModuleDef, Name, Variant};
55
use ide_db::{
66
defs::Definition,
77
helpers::{
@@ -133,7 +133,7 @@ fn existing_definition(db: &RootDatabase, variant_name: &ast::Name, variant: &Va
133133
),
134134
_ => false,
135135
})
136-
.any(|(name, _)| name == variant_name.as_name())
136+
.any(|(name, _)| name.to_string() == variant_name.to_string())
137137
}
138138

139139
fn insert_import(

crates/ide_assists/src/handlers/qualify_path.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::iter;
22

3-
use hir::{AsAssocItem, AsName};
3+
use hir::AsAssocItem;
44
use ide_db::helpers::{import_assets::ImportCandidate, mod_path_to_ast};
55
use ide_db::RootDatabase;
66
use syntax::{
@@ -160,7 +160,9 @@ fn find_trait_method(
160160
) -> Option<hir::Function> {
161161
if let Some(hir::AssocItem::Function(method)) =
162162
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)
164166
})
165167
{
166168
Some(method)

docs/dev/architecture.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ This is *the* entry point, but it front-loads a lot of complexity, so its fine t
4646

4747
`crates/rust-analyzer/src/handlers.rs` implements all LSP requests and is a great place to start if you are already familiar with LSP.
4848

49-
`Analysis` and `AnalysisHost` types define the main API.
49+
`Analysis` and `AnalysisHost` types define the main API for consumers of IDE services.
5050

5151
## Code Map
5252

0 commit comments

Comments
 (0)