@@ -17,7 +17,6 @@ use rustc_hir as hir;
17
17
use rustc_hir:: intravisit:: FnKind ;
18
18
use rustc_hir:: { Expr , FnDecl , Node } ;
19
19
use rustc_span:: symbol:: Ident ;
20
- use rustc_span:: Span ;
21
20
22
21
/// An FnLikeNode is a Node that is like a fn, in that it has a decl
23
22
/// and a body (as well as a NodeId, a span, etc).
@@ -116,7 +115,6 @@ struct ItemFnParts<'a> {
116
115
generics : & ' a hir:: Generics < ' a > ,
117
116
body : hir:: BodyId ,
118
117
id : hir:: HirId ,
119
- span : Span ,
120
118
attrs : & ' a [ Attribute ] ,
121
119
}
122
120
@@ -126,19 +124,12 @@ struct ClosureParts<'a> {
126
124
decl : & ' a FnDecl < ' a > ,
127
125
body : hir:: BodyId ,
128
126
id : hir:: HirId ,
129
- span : Span ,
130
127
attrs : & ' a [ Attribute ] ,
131
128
}
132
129
133
130
impl < ' a > ClosureParts < ' a > {
134
- fn new (
135
- d : & ' a FnDecl < ' a > ,
136
- b : hir:: BodyId ,
137
- id : hir:: HirId ,
138
- s : Span ,
139
- attrs : & ' a [ Attribute ] ,
140
- ) -> Self {
141
- ClosureParts { decl : d, body : b, id, span : s, attrs }
131
+ fn new ( d : & ' a FnDecl < ' a > , b : hir:: BodyId , id : hir:: HirId , attrs : & ' a [ Attribute ] ) -> Self {
132
+ ClosureParts { decl : d, body : b, id, attrs }
142
133
}
143
134
}
144
135
@@ -158,31 +149,23 @@ impl<'a> FnLikeNode<'a> {
158
149
pub fn body ( self ) -> hir:: BodyId {
159
150
self . handle (
160
151
|i : ItemFnParts < ' a > | i. body ,
161
- |_, _, _: & ' a hir:: FnSig < ' a > , _, body : hir:: BodyId , _, _ | body,
152
+ |_, _, _: & ' a hir:: FnSig < ' a > , _, body : hir:: BodyId , _| body,
162
153
|c : ClosureParts < ' a > | c. body ,
163
154
)
164
155
}
165
156
166
157
pub fn decl ( self ) -> & ' a FnDecl < ' a > {
167
158
self . handle (
168
159
|i : ItemFnParts < ' a > | & * i. decl ,
169
- |_, _, sig : & ' a hir:: FnSig < ' a > , _, _, _, _ | & sig. decl ,
160
+ |_, _, sig : & ' a hir:: FnSig < ' a > , _, _, _| & sig. decl ,
170
161
|c : ClosureParts < ' a > | c. decl ,
171
162
)
172
163
}
173
164
174
- pub fn span ( self ) -> Span {
175
- self . handle (
176
- |i : ItemFnParts < ' _ > | i. span ,
177
- |_, _, _: & ' a hir:: FnSig < ' a > , _, _, span, _| span,
178
- |c : ClosureParts < ' _ > | c. span ,
179
- )
180
- }
181
-
182
165
pub fn id ( self ) -> hir:: HirId {
183
166
self . handle (
184
167
|i : ItemFnParts < ' _ > | i. id ,
185
- |id, _, _: & ' a hir:: FnSig < ' a > , _, _, _, _ | id,
168
+ |id, _, _: & ' a hir:: FnSig < ' a > , _, _, _| id,
186
169
|c : ClosureParts < ' _ > | c. id ,
187
170
)
188
171
}
@@ -204,7 +187,7 @@ impl<'a> FnLikeNode<'a> {
204
187
FnKind :: ItemFn ( p. ident , p. generics , p. header , p. vis , p. attrs )
205
188
} ;
206
189
let closure = |c : ClosureParts < ' a > | FnKind :: Closure ( c. attrs ) ;
207
- let method = |_, ident : Ident , sig : & ' a hir:: FnSig < ' a > , vis, _, _ , attrs| {
190
+ let method = |_, ident : Ident , sig : & ' a hir:: FnSig < ' a > , vis, _, attrs| {
208
191
FnKind :: Method ( ident, sig, vis, attrs)
209
192
} ;
210
193
self . handle ( item, method, closure)
@@ -219,7 +202,6 @@ impl<'a> FnLikeNode<'a> {
219
202
& ' a hir:: FnSig < ' a > ,
220
203
Option < & ' a hir:: Visibility < ' a > > ,
221
204
hir:: BodyId ,
222
- Span ,
223
205
& ' a [ Attribute ] ,
224
206
) -> A ,
225
207
C : FnOnce ( ClosureParts < ' a > ) -> A ,
@@ -232,7 +214,6 @@ impl<'a> FnLikeNode<'a> {
232
214
decl : & sig. decl ,
233
215
body : block,
234
216
vis : & i. vis ,
235
- span : i. span ,
236
217
attrs : & i. attrs ,
237
218
header : sig. header ,
238
219
generics,
@@ -241,19 +222,19 @@ impl<'a> FnLikeNode<'a> {
241
222
} ,
242
223
Node :: TraitItem ( ti) => match ti. kind {
243
224
hir:: TraitItemKind :: Fn ( ref sig, hir:: TraitFn :: Provided ( body) ) => {
244
- method ( ti. hir_id , ti. ident , sig, None , body, ti . span , & ti. attrs )
225
+ method ( ti. hir_id , ti. ident , sig, None , body, & ti. attrs )
245
226
}
246
227
_ => bug ! ( "trait method FnLikeNode that is not fn-like" ) ,
247
228
} ,
248
229
Node :: ImplItem ( ii) => match ii. kind {
249
230
hir:: ImplItemKind :: Fn ( ref sig, body) => {
250
- method ( ii. hir_id , ii. ident , sig, Some ( & ii. vis ) , body, ii . span , & ii. attrs )
231
+ method ( ii. hir_id , ii. ident , sig, Some ( & ii. vis ) , body, & ii. attrs )
251
232
}
252
233
_ => bug ! ( "impl method FnLikeNode that is not fn-like" ) ,
253
234
} ,
254
235
Node :: Expr ( e) => match e. kind {
255
236
hir:: ExprKind :: Closure ( _, ref decl, block, _fn_decl_span, _gen) => {
256
- closure ( ClosureParts :: new ( & decl, block, e. hir_id , e . span , & e. attrs ) )
237
+ closure ( ClosureParts :: new ( & decl, block, e. hir_id , & e. attrs ) )
257
238
}
258
239
_ => bug ! ( "expr FnLikeNode that is not fn-like" ) ,
259
240
} ,
0 commit comments