@@ -11,7 +11,6 @@ use rustc_middle::lint::in_external_macro;
11
11
use rustc_semver:: RustcVersion ;
12
12
use rustc_session:: { declare_tool_lint, impl_lint_pass} ;
13
13
use rustc_span:: symbol:: sym;
14
- use rustc_span:: Span ;
15
14
use std:: ops:: ControlFlow ;
16
15
17
16
declare_clippy_lint ! {
@@ -66,7 +65,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualLetElse {
66
65
if !in_external_macro( cx. sess( ) , stmt. span) ;
67
66
if let StmtKind :: Local ( local) = stmt. kind;
68
67
if let Some ( init) = local. init;
69
- if !from_different_macros ( init. span, stmt. span) ;
68
+ if init. span. ctxt ( ) == stmt. span. ctxt ( ) ;
70
69
if let Some ( if_let_or_match) = IfLetOrMatch :: parse( cx, init) ;
71
70
then {
72
71
if_let_or_match
@@ -179,23 +178,6 @@ fn expr_diverges(cx: &LateContext<'_>, expr: &'_ Expr<'_>) -> bool {
179
178
. is_some ( )
180
179
}
181
180
182
- /// Returns true if the two spans come from different macro sites,
183
- /// or one comes from an invocation and the other is not from a macro at all.
184
- fn from_different_macros ( span_a : Span , span_b : Span ) -> bool {
185
- // This pre-check is a speed up so that we don't build outer_expn_data unless needed.
186
- match ( span_a. from_expansion ( ) , span_b. from_expansion ( ) ) {
187
- ( false , false ) => return false ,
188
- ( true , false ) | ( false , true ) => return true ,
189
- // We need to determine if both are from the same macro
190
- ( true , true ) => ( ) ,
191
- }
192
- let data_for_comparison = |sp : Span | {
193
- let expn_data = sp. ctxt ( ) . outer_expn_data ( ) ;
194
- ( expn_data. kind , expn_data. call_site )
195
- } ;
196
- data_for_comparison ( span_a) != data_for_comparison ( span_b)
197
- }
198
-
199
181
fn pat_allowed_for_else ( cx : & LateContext < ' _ > , pat : & ' _ Pat < ' _ > ) -> bool {
200
182
// Check whether the pattern contains any bindings, as the
201
183
// binding might potentially be used in the body.
0 commit comments