@@ -123,10 +123,9 @@ impl<'a, 'tcx, 'v> Hir2Qmm<'a, 'tcx, 'v> {
123
123
let negated = match e. node {
124
124
ExprBinary ( binop, ref lhs, ref rhs) => {
125
125
126
- match implements_ord ( self . cx , lhs) {
127
- Some ( true ) => ( ) ,
128
- _ => continue ,
129
- } ;
126
+ if !implements_ord ( self . cx , lhs) {
127
+ continue ;
128
+ }
130
129
131
130
let mk_expr = |op| {
132
131
Expr {
@@ -181,10 +180,9 @@ impl<'a, 'tcx, 'v> SuggestContext<'a, 'tcx, 'v> {
181
180
match expr. node {
182
181
ExprBinary ( binop, ref lhs, ref rhs) => {
183
182
184
- match implements_ord ( self . cx , lhs) {
185
- Some ( true ) => ( ) ,
186
- _ => return None ,
187
- } ;
183
+ if !implements_ord ( self . cx , lhs) {
184
+ return None ;
185
+ }
188
186
189
187
match binop. node {
190
188
BiEq => Some ( " != " ) ,
@@ -458,12 +456,9 @@ impl<'a, 'tcx> Visitor<'tcx> for NonminimalBoolVisitor<'a, 'tcx> {
458
456
}
459
457
460
458
461
- fn implements_ord < ' a , ' tcx > ( cx : & ' a LateContext < ' a , ' tcx > , expr : & Expr ) -> Option < bool > {
459
+ fn implements_ord < ' a , ' tcx > ( cx : & ' a LateContext < ' a , ' tcx > , expr : & Expr ) -> bool {
462
460
let ty = cx. tables . expr_ty ( expr) ;
463
-
464
- return if let Some ( id) = get_trait_def_id ( cx, & paths:: ORD ) {
465
- Some ( implements_trait ( cx, ty, id, & [ ] ) )
466
- } else {
467
- None
468
- } ;
461
+ get_trait_def_id ( cx, & paths:: ORD )
462
+ . map ( |id| implements_trait ( cx, ty, id, & [ ] ) )
463
+ . unwrap_or ( false )
469
464
}
0 commit comments