@@ -225,23 +225,23 @@ fn check_comparison<'a, 'tcx>(
225225 use self :: Expression :: * ;
226226
227227 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 ) | {
245245 let left_side = Sugg :: hir_with_applicability ( cx, left_side, ".." , & mut applicability) ;
246246 let right_side = Sugg :: hir_with_applicability ( cx, right_side, ".." , & mut applicability) ;
247247 span_lint_and_sugg (
@@ -253,9 +253,9 @@ fn check_comparison<'a, 'tcx>(
253253 h ( left_side, right_side) . to_string ( ) ,
254254 applicability,
255255 )
256- }
257- } ) ,
258- _ => ( ) ,
256+ } ) ,
257+ _ => ( ) ,
258+ }
259259 }
260260 }
261261}
0 commit comments