@@ -57,7 +57,7 @@ impl<'a> DefCollector<'a> {
57
57
58
58
// For async functions, we need to create their inner defs inside of a
59
59
// closure to match their desugared representation.
60
- let fn_def_data = DefPathData :: ValueNs ( name. as_interned_str ( ) ) ;
60
+ let fn_def_data = DefPathData :: ValueNs ( name) ;
61
61
let fn_def = self . create_def ( id, fn_def_data, span) ;
62
62
return self . with_parent ( fn_def, |this| {
63
63
this. create_def ( return_impl_trait_id, DefPathData :: ImplTrait , span) ;
@@ -83,8 +83,7 @@ impl<'a> DefCollector<'a> {
83
83
. unwrap_or_else ( || {
84
84
let node_id = NodeId :: placeholder_from_expn_id ( self . expansion ) ;
85
85
sym:: integer ( self . definitions . placeholder_field_indices [ & node_id] )
86
- } )
87
- . as_interned_str ( ) ;
86
+ } ) ;
88
87
let def = self . create_def ( field. id , DefPathData :: ValueNs ( name) , field. span ) ;
89
88
self . with_parent ( def, |this| visit:: walk_struct_field ( this, field) ) ;
90
89
}
@@ -109,7 +108,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
109
108
ItemKind :: Mod ( ..) | ItemKind :: Trait ( ..) | ItemKind :: TraitAlias ( ..) |
110
109
ItemKind :: Enum ( ..) | ItemKind :: Struct ( ..) | ItemKind :: Union ( ..) |
111
110
ItemKind :: OpaqueTy ( ..) | ItemKind :: ExternCrate ( ..) | ItemKind :: ForeignMod ( ..) |
112
- ItemKind :: TyAlias ( ..) => DefPathData :: TypeNs ( i. ident . as_interned_str ( ) ) ,
111
+ ItemKind :: TyAlias ( ..) => DefPathData :: TypeNs ( i. ident . name ) ,
113
112
ItemKind :: Fn (
114
113
ref decl,
115
114
ref header,
@@ -127,8 +126,8 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
127
126
)
128
127
}
129
128
ItemKind :: Static ( ..) | ItemKind :: Const ( ..) | ItemKind :: Fn ( ..) =>
130
- DefPathData :: ValueNs ( i. ident . as_interned_str ( ) ) ,
131
- ItemKind :: MacroDef ( ..) => DefPathData :: MacroNs ( i. ident . as_interned_str ( ) ) ,
129
+ DefPathData :: ValueNs ( i. ident . name ) ,
130
+ ItemKind :: MacroDef ( ..) => DefPathData :: MacroNs ( i. ident . name ) ,
132
131
ItemKind :: Mac ( ..) => return self . visit_macro_invoc ( i. id ) ,
133
132
ItemKind :: GlobalAsm ( ..) => DefPathData :: Misc ,
134
133
ItemKind :: Use ( ..) => {
@@ -162,7 +161,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
162
161
}
163
162
164
163
let def = self . create_def ( foreign_item. id ,
165
- DefPathData :: ValueNs ( foreign_item. ident . as_interned_str ( ) ) ,
164
+ DefPathData :: ValueNs ( foreign_item. ident . name ) ,
166
165
foreign_item. span ) ;
167
166
168
167
self . with_parent ( def, |this| {
@@ -175,7 +174,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
175
174
return self . visit_macro_invoc ( v. id ) ;
176
175
}
177
176
let def = self . create_def ( v. id ,
178
- DefPathData :: TypeNs ( v. ident . as_interned_str ( ) ) ,
177
+ DefPathData :: TypeNs ( v. ident . name ) ,
179
178
v. span ) ;
180
179
self . with_parent ( def, |this| {
181
180
if let Some ( ctor_hir_id) = v. data . ctor_id ( ) {
@@ -202,7 +201,7 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
202
201
self . visit_macro_invoc ( param. id ) ;
203
202
return ;
204
203
}
205
- let name = param. ident . as_interned_str ( ) ;
204
+ let name = param. ident . name ;
206
205
let def_path_data = match param. kind {
207
206
GenericParamKind :: Lifetime { .. } => DefPathData :: LifetimeNs ( name) ,
208
207
GenericParamKind :: Type { .. } => DefPathData :: TypeNs ( name) ,
@@ -216,9 +215,9 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
216
215
fn visit_trait_item ( & mut self , ti : & ' a TraitItem ) {
217
216
let def_data = match ti. kind {
218
217
TraitItemKind :: Method ( ..) | TraitItemKind :: Const ( ..) =>
219
- DefPathData :: ValueNs ( ti. ident . as_interned_str ( ) ) ,
218
+ DefPathData :: ValueNs ( ti. ident . name ) ,
220
219
TraitItemKind :: Type ( ..) => {
221
- DefPathData :: TypeNs ( ti. ident . as_interned_str ( ) )
220
+ DefPathData :: TypeNs ( ti. ident . name )
222
221
} ,
223
222
TraitItemKind :: Macro ( ..) => return self . visit_macro_invoc ( ti. id ) ,
224
223
} ;
@@ -243,12 +242,10 @@ impl<'a> visit::Visitor<'a> for DefCollector<'a> {
243
242
body,
244
243
)
245
244
}
246
- ImplItemKind :: Method ( ..) | ImplItemKind :: Const ( .. ) =>
247
- DefPathData :: ValueNs ( ii. ident . as_interned_str ( ) ) ,
245
+ ImplItemKind :: Method ( ..) |
246
+ ImplItemKind :: Const ( .. ) => DefPathData :: ValueNs ( ii. ident . name ) ,
248
247
ImplItemKind :: TyAlias ( ..) |
249
- ImplItemKind :: OpaqueTy ( ..) => {
250
- DefPathData :: TypeNs ( ii. ident . as_interned_str ( ) )
251
- } ,
248
+ ImplItemKind :: OpaqueTy ( ..) => DefPathData :: TypeNs ( ii. ident . name ) ,
252
249
ImplItemKind :: Macro ( ..) => return self . visit_macro_invoc ( ii. id ) ,
253
250
} ;
254
251
0 commit comments