@@ -453,9 +453,6 @@ fn is_float_mul_expr<'a>(cx: &LateContext<'_>, expr: &'a Expr<'a>) -> Option<(&'
453
453
454
454
// TODO: Fix rust-lang/rust-clippy#4735
455
455
fn check_mul_add ( cx : & LateContext < ' _ > , expr : & Expr < ' _ > ) {
456
- if is_no_std_crate ( cx) {
457
- return ; // The suggested methods are not available in core
458
- }
459
456
if let ExprKind :: Binary (
460
457
Spanned {
461
458
node : op @ ( BinOpKind :: Add | BinOpKind :: Sub ) ,
@@ -570,9 +567,6 @@ fn are_negated<'a>(cx: &LateContext<'_>, expr1: &'a Expr<'a>, expr2: &'a Expr<'a
570
567
}
571
568
572
569
fn check_custom_abs ( cx : & LateContext < ' _ > , expr : & Expr < ' _ > ) {
573
- if is_no_std_crate ( cx) {
574
- return ; // The suggested methods are not available in core
575
- }
576
570
if_chain ! {
577
571
if let Some ( higher:: If { cond, then, r#else: Some ( r#else) } ) = higher:: If :: hir( expr) ;
578
572
let if_body_expr = peel_blocks( then) ;
@@ -737,15 +731,15 @@ fn check_radians(cx: &LateContext<'_>, expr: &Expr<'_>) {
737
731
738
732
impl < ' tcx > LateLintPass < ' tcx > for FloatingPointArithmetic {
739
733
fn check_expr ( & mut self , cx : & LateContext < ' tcx > , expr : & ' tcx Expr < ' _ > ) {
740
- // All of these operations are currently not const.
734
+ // All of these operations are currently not const and are in std .
741
735
if in_constant ( cx, expr. hir_id ) {
742
736
return ;
743
737
}
744
738
745
739
if let ExprKind :: MethodCall ( path, receiver, args, _) = & expr. kind {
746
740
let recv_ty = cx. typeck_results ( ) . expr_ty ( receiver) ;
747
741
748
- if recv_ty. is_floating_point ( ) {
742
+ if recv_ty. is_floating_point ( ) && ! is_no_std_crate ( cx ) {
749
743
match path. ident . name . as_str ( ) {
750
744
"ln" => check_ln1p ( cx, expr, receiver) ,
751
745
"log" => check_log_base ( cx, expr, receiver, args) ,
@@ -756,10 +750,12 @@ impl<'tcx> LateLintPass<'tcx> for FloatingPointArithmetic {
756
750
}
757
751
}
758
752
} else {
759
- check_expm1 ( cx, expr) ;
760
- check_mul_add ( cx, expr) ;
761
- check_custom_abs ( cx, expr) ;
762
- check_log_division ( cx, expr) ;
753
+ if !is_no_std_crate ( cx) {
754
+ check_expm1 ( cx, expr) ;
755
+ check_mul_add ( cx, expr) ;
756
+ check_custom_abs ( cx, expr) ;
757
+ check_log_division ( cx, expr) ;
758
+ }
763
759
check_radians ( cx, expr) ;
764
760
}
765
761
}
0 commit comments