Skip to content

Commit 5749054

Browse files
committed
globally ignore #[no_std] crates
1 parent 7bc3da9 commit 5749054

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

clippy_lints/src/floating_point_arithmetic.rs

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,6 @@ fn is_float_mul_expr<'a>(cx: &LateContext<'_>, expr: &'a Expr<'a>) -> Option<(&'
453453

454454
// TODO: Fix rust-lang/rust-clippy#4735
455455
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-
}
459456
if let ExprKind::Binary(
460457
Spanned {
461458
node: op @ (BinOpKind::Add | BinOpKind::Sub),
@@ -570,9 +567,6 @@ fn are_negated<'a>(cx: &LateContext<'_>, expr1: &'a Expr<'a>, expr2: &'a Expr<'a
570567
}
571568

572569
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-
}
576570
if_chain! {
577571
if let Some(higher::If { cond, then, r#else: Some(r#else) }) = higher::If::hir(expr);
578572
let if_body_expr = peel_blocks(then);
@@ -737,8 +731,8 @@ fn check_radians(cx: &LateContext<'_>, expr: &Expr<'_>) {
737731

738732
impl<'tcx> LateLintPass<'tcx> for FloatingPointArithmetic {
739733
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'_>) {
740-
// All of these operations are currently not const.
741-
if in_constant(cx, expr.hir_id) {
734+
// 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) {
742736
return;
743737
}
744738

0 commit comments

Comments
 (0)