@@ -7,23 +7,23 @@ use clippy_utils::consts::{ConstEvalLateContext, Constant};
7
7
use if_chain:: if_chain;
8
8
use rustc_hir:: { BinOpKind , Expr , ExprKind } ;
9
9
use rustc_lint:: LateContext ;
10
- use rustc_middle:: ty:: { layout:: HasTyCtxt , Ty , TypeckResults } ;
10
+ use rustc_middle:: ty:: layout:: HasTyCtxt ;
11
+ use rustc_middle:: ty:: { Ty , TypeckResults } ;
11
12
use rustc_span:: source_map:: { Span , Spanned } ;
12
13
13
14
use clippy_utils:: diagnostics:: span_lint_and_note;
14
15
use clippy_utils:: source:: snippet;
15
16
use clippy_utils:: SpanlessEq ;
16
17
17
- use super :: IMPOSSIBLE_COMPARISONS ;
18
- use super :: REDUNDANT_COMPARISONS ;
18
+ use super :: { IMPOSSIBLE_COMPARISONS , REDUNDANT_COMPARISONS } ;
19
19
20
20
// Extract a comparison between a const and non-const
21
21
// Flip yoda conditionals, turnings expressions like `42 < x` into `x > 42`
22
22
fn comparison_to_const < ' tcx > (
23
23
ctx : & mut ConstEvalLateContext < ' _ , ' tcx > ,
24
24
typeck : & TypeckResults < ' tcx > ,
25
25
expr : & ' tcx Expr < ' tcx > ,
26
- ) -> Option < ( CmpOp , & ' tcx Expr < ' tcx > , & ' tcx Expr < ' tcx > , Constant , Ty < ' tcx > ) > {
26
+ ) -> Option < ( CmpOp , & ' tcx Expr < ' tcx > , & ' tcx Expr < ' tcx > , Constant < ' tcx > , Ty < ' tcx > ) > {
27
27
if_chain ! {
28
28
if let ExprKind :: Binary ( operator, left, right) = expr. kind;
29
29
if let Ok ( cmp_op) = CmpOp :: try_from( operator. node) ;
0 commit comments