@@ -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).
@@ -104,7 +103,6 @@ struct ItemFnParts<'a> {
104
103
generics : & ' a hir:: Generics < ' a > ,
105
104
body : hir:: BodyId ,
106
105
id : hir:: HirId ,
107
- span : Span ,
108
106
attrs : & ' a [ Attribute ] ,
109
107
}
110
108
@@ -114,19 +112,12 @@ struct ClosureParts<'a> {
114
112
decl : & ' a FnDecl < ' a > ,
115
113
body : hir:: BodyId ,
116
114
id : hir:: HirId ,
117
- span : Span ,
118
115
attrs : & ' a [ Attribute ] ,
119
116
}
120
117
121
118
impl < ' a > ClosureParts < ' a > {
122
- fn new (
123
- d : & ' a FnDecl < ' a > ,
124
- b : hir:: BodyId ,
125
- id : hir:: HirId ,
126
- s : Span ,
127
- attrs : & ' a [ Attribute ] ,
128
- ) -> Self {
129
- ClosureParts { decl : d, body : b, id, span : s, attrs }
119
+ fn new ( d : & ' a FnDecl < ' a > , b : hir:: BodyId , id : hir:: HirId , attrs : & ' a [ Attribute ] ) -> Self {
120
+ ClosureParts { decl : d, body : b, id, attrs }
130
121
}
131
122
}
132
123
@@ -146,31 +137,23 @@ impl<'a> FnLikeNode<'a> {
146
137
pub fn body ( self ) -> hir:: BodyId {
147
138
self . handle (
148
139
|i : ItemFnParts < ' a > | i. body ,
149
- |_, _, _: & ' a hir:: FnSig < ' a > , _, body : hir:: BodyId , _, _ | body,
140
+ |_, _, _: & ' a hir:: FnSig < ' a > , _, body : hir:: BodyId , _| body,
150
141
|c : ClosureParts < ' a > | c. body ,
151
142
)
152
143
}
153
144
154
145
pub fn decl ( self ) -> & ' a FnDecl < ' a > {
155
146
self . handle (
156
147
|i : ItemFnParts < ' a > | & * i. decl ,
157
- |_, _, sig : & ' a hir:: FnSig < ' a > , _, _, _, _ | & sig. decl ,
148
+ |_, _, sig : & ' a hir:: FnSig < ' a > , _, _, _| & sig. decl ,
158
149
|c : ClosureParts < ' a > | c. decl ,
159
150
)
160
151
}
161
152
162
- pub fn span ( self ) -> Span {
163
- self . handle (
164
- |i : ItemFnParts < ' _ > | i. span ,
165
- |_, _, _: & ' a hir:: FnSig < ' a > , _, _, span, _| span,
166
- |c : ClosureParts < ' _ > | c. span ,
167
- )
168
- }
169
-
170
153
pub fn id ( self ) -> hir:: HirId {
171
154
self . handle (
172
155
|i : ItemFnParts < ' _ > | i. id ,
173
- |id, _, _: & ' a hir:: FnSig < ' a > , _, _, _, _ | id,
156
+ |id, _, _: & ' a hir:: FnSig < ' a > , _, _, _| id,
174
157
|c : ClosureParts < ' _ > | c. id ,
175
158
)
176
159
}
@@ -192,7 +175,7 @@ impl<'a> FnLikeNode<'a> {
192
175
FnKind :: ItemFn ( p. ident , p. generics , p. header , p. vis , p. attrs )
193
176
} ;
194
177
let closure = |c : ClosureParts < ' a > | FnKind :: Closure ( c. attrs ) ;
195
- let method = |_, ident : Ident , sig : & ' a hir:: FnSig < ' a > , vis, _, _ , attrs| {
178
+ let method = |_, ident : Ident , sig : & ' a hir:: FnSig < ' a > , vis, _, attrs| {
196
179
FnKind :: Method ( ident, sig, vis, attrs)
197
180
} ;
198
181
self . handle ( item, method, closure)
@@ -207,7 +190,6 @@ impl<'a> FnLikeNode<'a> {
207
190
& ' a hir:: FnSig < ' a > ,
208
191
Option < & ' a hir:: Visibility < ' a > > ,
209
192
hir:: BodyId ,
210
- Span ,
211
193
& ' a [ Attribute ] ,
212
194
) -> A ,
213
195
C : FnOnce ( ClosureParts < ' a > ) -> A ,
@@ -220,7 +202,6 @@ impl<'a> FnLikeNode<'a> {
220
202
decl : & sig. decl ,
221
203
body : block,
222
204
vis : & i. vis ,
223
- span : i. span ,
224
205
attrs : & i. attrs ,
225
206
header : sig. header ,
226
207
generics,
@@ -229,19 +210,19 @@ impl<'a> FnLikeNode<'a> {
229
210
} ,
230
211
Node :: TraitItem ( ti) => match ti. kind {
231
212
hir:: TraitItemKind :: Fn ( ref sig, hir:: TraitFn :: Provided ( body) ) => {
232
- method ( ti. hir_id , ti. ident , sig, None , body, ti . span , & ti. attrs )
213
+ method ( ti. hir_id , ti. ident , sig, None , body, & ti. attrs )
233
214
}
234
215
_ => bug ! ( "trait method FnLikeNode that is not fn-like" ) ,
235
216
} ,
236
217
Node :: ImplItem ( ii) => match ii. kind {
237
218
hir:: ImplItemKind :: Fn ( ref sig, body) => {
238
- method ( ii. hir_id , ii. ident , sig, Some ( & ii. vis ) , body, ii . span , & ii. attrs )
219
+ method ( ii. hir_id , ii. ident , sig, Some ( & ii. vis ) , body, & ii. attrs )
239
220
}
240
221
_ => bug ! ( "impl method FnLikeNode that is not fn-like" ) ,
241
222
} ,
242
223
Node :: Expr ( e) => match e. kind {
243
224
hir:: ExprKind :: Closure ( _, ref decl, block, _fn_decl_span, _gen) => {
244
- closure ( ClosureParts :: new ( & decl, block, e. hir_id , e . span , & e. attrs ) )
225
+ closure ( ClosureParts :: new ( & decl, block, e. hir_id , & e. attrs ) )
245
226
}
246
227
_ => bug ! ( "expr FnLikeNode that is not fn-like" ) ,
247
228
} ,
0 commit comments