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