@@ -179,37 +179,22 @@ impl LateLintPass<'_> for ManualMap {
179
179
} else {
180
180
""
181
181
} ;
182
+ let expr_snip = snippet_with_context( cx, some_expr. expr. span, expr_ctxt, ".." , & mut app) . 0 ;
182
183
if some_expr. needs_unsafe_block {
183
- format!(
184
- "|{}{}| unsafe {{ {} }}" ,
185
- annotation,
186
- some_binding,
187
- snippet_with_context( cx, some_expr. expr. span, expr_ctxt, ".." , & mut app) . 0
188
- )
184
+ format!( "|{}{}| unsafe {{ {} }}" , annotation, some_binding, expr_snip)
189
185
} else {
190
- format!(
191
- "|{}{}| {}" ,
192
- annotation,
193
- some_binding,
194
- snippet_with_context( cx, some_expr. expr. span, expr_ctxt, ".." , & mut app) . 0
195
- )
186
+ format!( "|{}{}| {}" , annotation, some_binding, expr_snip)
196
187
}
197
188
}
198
189
}
199
190
} else if !is_wild_none && explicit_ref. is_none ( ) {
200
191
// TODO: handle explicit reference annotations.
192
+ let pat_snip = snippet_with_context ( cx, some_pat. span , expr_ctxt, ".." , & mut app) . 0 ;
193
+ let expr_snip = snippet_with_context ( cx, some_expr. expr . span , expr_ctxt, ".." , & mut app) . 0 ;
201
194
if some_expr. needs_unsafe_block {
202
- format ! (
203
- "|{}| unsafe {{ {} }}" ,
204
- snippet_with_context( cx, some_pat. span, expr_ctxt, ".." , & mut app) . 0 ,
205
- snippet_with_context( cx, some_expr. expr. span, expr_ctxt, ".." , & mut app) . 0
206
- )
195
+ format ! ( "|{}| unsafe {{ {} }}" , pat_snip, expr_snip)
207
196
} else {
208
- format ! (
209
- "|{}| {}" ,
210
- snippet_with_context( cx, some_pat. span, expr_ctxt, ".." , & mut app) . 0 ,
211
- snippet_with_context( cx, some_expr. expr. span, expr_ctxt, ".." , & mut app) . 0
212
- )
197
+ format ! ( "|{}| {}" , pat_snip, expr_snip)
213
198
}
214
199
} else {
215
200
// Refutable bindings and mixed reference annotations can't be handled by `map`.
0 commit comments