Skip to content

Commit 0dd2501

Browse files
committed
Don't ignore check_radians
1 parent 5749054 commit 0dd2501

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

clippy_lints/src/floating_point_arithmetic.rs

+8-6
Original file line numberDiff line numberDiff line change
@@ -732,14 +732,14 @@ fn check_radians(cx: &LateContext<'_>, expr: &Expr<'_>) {
732732
impl<'tcx> LateLintPass<'tcx> for FloatingPointArithmetic {
733733
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
734734
// All of these operations are currently not const and are in std.
735-
if in_constant(cx, expr.hir_id) || is_no_std_crate(cx) {
735+
if in_constant(cx, expr.hir_id) {
736736
return;
737737
}
738738

739739
if let ExprKind::MethodCall(path, receiver, args, _) = &expr.kind {
740740
let recv_ty = cx.typeck_results().expr_ty(receiver);
741741

742-
if recv_ty.is_floating_point() {
742+
if recv_ty.is_floating_point() && !is_no_std_crate(cx) {
743743
match path.ident.name.as_str() {
744744
"ln" => check_ln1p(cx, expr, receiver),
745745
"log" => check_log_base(cx, expr, receiver, args),
@@ -750,10 +750,12 @@ impl<'tcx> LateLintPass<'tcx> for FloatingPointArithmetic {
750750
}
751751
}
752752
} else {
753-
check_expm1(cx, expr);
754-
check_mul_add(cx, expr);
755-
check_custom_abs(cx, expr);
756-
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+
}
757759
check_radians(cx, expr);
758760
}
759761
}

0 commit comments

Comments
 (0)