@@ -2,7 +2,7 @@ use clippy_utils::diagnostics::span_lint_and_then;
2
2
use clippy_utils:: higher:: IfLetOrMatch ;
3
3
use clippy_utils:: msrvs:: { self , Msrv } ;
4
4
use clippy_utils:: peel_blocks;
5
- use clippy_utils:: source:: { snippet , snippet_with_macro_callsite } ;
5
+ use clippy_utils:: source:: snippet_with_context ;
6
6
use clippy_utils:: ty:: is_type_diagnostic_item;
7
7
use clippy_utils:: visitors:: { for_each_expr, Descend } ;
8
8
use if_chain:: if_chain;
@@ -141,16 +141,10 @@ fn emit_manual_let_else(cx: &LateContext<'_>, span: Span, expr: &Expr<'_>, pat:
141
141
// * unused binding collision detection with existing ones
142
142
// * putting patterns with at the top level | inside ()
143
143
// for this to be machine applicable.
144
- let app = Applicability :: HasPlaceholders ;
145
-
146
- let snippet_fn = if span. from_expansion ( ) {
147
- snippet
148
- } else {
149
- snippet_with_macro_callsite
150
- } ;
151
- let sn_pat = snippet_fn ( cx, pat. span , "" ) ;
152
- let sn_expr = snippet_fn ( cx, expr. span , "" ) ;
153
- let sn_else = snippet_fn ( cx, else_body. span , "" ) ;
144
+ let mut app = Applicability :: HasPlaceholders ;
145
+ let ( sn_pat, _) = snippet_with_context ( cx, pat. span , span. ctxt ( ) , "" , & mut app) ;
146
+ let ( sn_expr, _) = snippet_with_context ( cx, expr. span , span. ctxt ( ) , "" , & mut app) ;
147
+ let ( sn_else, _) = snippet_with_context ( cx, else_body. span , span. ctxt ( ) , "" , & mut app) ;
154
148
155
149
let else_bl = if matches ! ( else_body. kind, ExprKind :: Block ( ..) ) {
156
150
sn_else. into_owned ( )
0 commit comments