Don't ignore check_radians

This commit is contained in:
blyxyas 2023-05-02 20:47:18 +02:00
parent 5749054241
commit 0dd2501e0d
No known key found for this signature in database
GPG key ID: 4D38170B5A2FC334

View file

@ -732,14 +732,14 @@ fn check_radians(cx: &LateContext<'_>, expr: &Expr<'_>) {
impl<'tcx> LateLintPass<'tcx> for FloatingPointArithmetic {
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
// All of these operations are currently not const and are in std.
if in_constant(cx, expr.hir_id) || is_no_std_crate(cx) {
if in_constant(cx, expr.hir_id) {
return;
}
if let ExprKind::MethodCall(path, receiver, args, _) = &expr.kind {
let recv_ty = cx.typeck_results().expr_ty(receiver);
if recv_ty.is_floating_point() {
if recv_ty.is_floating_point() && !is_no_std_crate(cx) {
match path.ident.name.as_str() {
"ln" => check_ln1p(cx, expr, receiver),
"log" => check_log_base(cx, expr, receiver, args),
@ -750,10 +750,12 @@ impl<'tcx> LateLintPass<'tcx> for FloatingPointArithmetic {
}
}
} else {
if !is_no_std_crate(cx) {
check_expm1(cx, expr);
check_mul_add(cx, expr);
check_custom_abs(cx, expr);
check_log_division(cx, expr);
}
check_radians(cx, expr);
}
}