@@ -380,16 +380,18 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for MiscLints {
380
380
let lhs = Sugg :: hir ( cx, left, ".." ) ;
381
381
let rhs = Sugg :: hir ( cx, right, ".." ) ;
382
382
383
- db. span_suggestion (
384
- expr. span ,
385
- "consider comparing them within some error" ,
386
- format ! (
387
- "({}).abs() {} error" ,
388
- lhs - rhs,
389
- if op == BinOpKind :: Eq { '<' } else { '>' }
390
- ) ,
391
- Applicability :: HasPlaceholders , // snippet
392
- ) ;
383
+ if !( is_array ( cx, left) || is_array ( cx, right) ) {
384
+ db. span_suggestion (
385
+ expr. span ,
386
+ "consider comparing them within some error" ,
387
+ format ! (
388
+ "({}).abs() {} error" ,
389
+ lhs - rhs,
390
+ if op == BinOpKind :: Eq { '<' } else { '>' }
391
+ ) ,
392
+ Applicability :: HasPlaceholders , // snippet
393
+ ) ;
394
+ }
393
395
db. span_note ( expr. span , "`std::f32::EPSILON` and `std::f64::EPSILON` are available." ) ;
394
396
} ) ;
395
397
} else if op == BinOpKind :: Rem && is_integer_const ( cx, right, 1 ) {
@@ -515,6 +517,10 @@ fn is_float(cx: &LateContext<'_, '_>, expr: &Expr<'_>) -> bool {
515
517
matches ! ( value, ty:: Float ( _) )
516
518
}
517
519
520
+ fn is_array ( cx : & LateContext < ' _ , ' _ > , expr : & Expr < ' _ > ) -> bool {
521
+ matches ! ( & walk_ptrs_ty( cx. tables. expr_ty( expr) ) . kind, ty:: Array ( _, _) )
522
+ }
523
+
518
524
fn check_to_owned ( cx : & LateContext < ' _ , ' _ > , expr : & Expr < ' _ > , other : & Expr < ' _ > ) {
519
525
let ( arg_ty, snip) = match expr. kind {
520
526
ExprKind :: MethodCall ( .., ref args) if args. len ( ) == 1 => {
0 commit comments