@@ -225,23 +225,23 @@ fn check_comparison<'a, 'tcx>(
225
225
use self :: Expression :: * ;
226
226
227
227
if let ExprKind :: Binary ( _, ref left_side, ref right_side) = e. node {
228
- let mut applicability = Applicability :: MachineApplicable ;
229
- match ( fetch_bool_expr ( left_side ) , fetch_bool_expr ( right_side ) ) {
230
- ( Bool ( true ) , Other ) => left_true . map_or ( ( ) , | ( h , m ) | {
231
- suggest_bool_comparison ( cx , e , right_side, applicability , m , h )
232
- } ) ,
233
- ( Other , Bool ( true ) ) => right_true . map_or ( ( ) , | ( h , m ) | {
234
- suggest_bool_comparison ( cx , e , left_side , applicability , m , h )
235
- } ) ,
236
- ( Bool ( false ) , Other ) => left_false . map_or ( ( ) , | ( h , m ) | {
237
- suggest_bool_comparison ( cx , e , right_side , applicability , m , h )
238
- } ) ,
239
- ( Other , Bool ( false ) ) => right_false . map_or ( ( ) , | ( h , m ) | {
240
- suggest_bool_comparison ( cx , e , left_side , applicability , m , h )
241
- } ) ,
242
- ( Other , Other ) => no_literal . map_or ( ( ) , | ( h , m ) | {
243
- let ( l_ty , r_ty ) = ( cx . tables . expr_ty ( left_side ) , cx . tables . expr_ty ( right_side ) ) ;
244
- if l_ty . is_bool ( ) && r_ty . is_bool ( ) {
228
+ let ( l_ty , r_ty ) = ( cx . tables . expr_ty ( left_side ) , cx . tables . expr_ty ( right_side ) ) ;
229
+ if l_ty . is_bool ( ) && r_ty . is_bool ( ) {
230
+ let mut applicability = Applicability :: MachineApplicable ;
231
+ match ( fetch_bool_expr ( left_side ) , fetch_bool_expr ( right_side) ) {
232
+ ( Bool ( true ) , Other ) => left_true . map_or ( ( ) , | ( h , m ) | {
233
+ suggest_bool_comparison ( cx , e , right_side , applicability , m , h )
234
+ } ) ,
235
+ ( Other , Bool ( true ) ) => right_true . map_or ( ( ) , | ( h , m ) | {
236
+ suggest_bool_comparison ( cx , e , left_side , applicability , m , h )
237
+ } ) ,
238
+ ( Bool ( false ) , Other ) => left_false . map_or ( ( ) , | ( h , m ) | {
239
+ suggest_bool_comparison ( cx , e , right_side , applicability , m , h )
240
+ } ) ,
241
+ ( Other , Bool ( false ) ) => right_false . map_or ( ( ) , | ( h , m ) | {
242
+ suggest_bool_comparison ( cx , e , left_side , applicability , m , h )
243
+ } ) ,
244
+ ( Other , Other ) => no_literal . map_or ( ( ) , | ( h , m ) | {
245
245
let left_side = Sugg :: hir_with_applicability ( cx, left_side, ".." , & mut applicability) ;
246
246
let right_side = Sugg :: hir_with_applicability ( cx, right_side, ".." , & mut applicability) ;
247
247
span_lint_and_sugg (
@@ -253,9 +253,9 @@ fn check_comparison<'a, 'tcx>(
253
253
h ( left_side, right_side) . to_string ( ) ,
254
254
applicability,
255
255
)
256
- }
257
- } ) ,
258
- _ => ( ) ,
256
+ } ) ,
257
+ _ => ( ) ,
258
+ }
259
259
}
260
260
}
261
261
}
0 commit comments