@@ -2,9 +2,10 @@ use clippy_utils::consts::{
2
2
constant, constant_simple, Constant ,
3
3
Constant :: { Int , F32 , F64 } ,
4
4
} ;
5
- use clippy_utils:: diagnostics:: span_lint_and_sugg;
6
- use clippy_utils:: higher;
7
- use clippy_utils:: { eq_expr_value, get_parent_expr, in_constant, numeric_literal, peel_blocks, sugg} ;
5
+ use clippy_utils:: {
6
+ diagnostics:: span_lint_and_sugg, eq_expr_value, get_parent_expr, higher, in_constant, is_no_std_crate,
7
+ numeric_literal, peel_blocks, sugg,
8
+ } ;
8
9
use if_chain:: if_chain;
9
10
use rustc_errors:: Applicability ;
10
11
use rustc_hir:: { BinOpKind , Expr , ExprKind , PathSegment , UnOp } ;
@@ -452,6 +453,9 @@ fn is_float_mul_expr<'a>(cx: &LateContext<'_>, expr: &'a Expr<'a>) -> Option<(&'
452
453
453
454
// TODO: Fix rust-lang/rust-clippy#4735
454
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
+ }
455
459
if let ExprKind :: Binary (
456
460
Spanned {
457
461
node : op @ ( BinOpKind :: Add | BinOpKind :: Sub ) ,
@@ -566,6 +570,9 @@ fn are_negated<'a>(cx: &LateContext<'_>, expr1: &'a Expr<'a>, expr2: &'a Expr<'a
566
570
}
567
571
568
572
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
+ }
569
576
if_chain ! {
570
577
if let Some ( higher:: If { cond, then, r#else: Some ( r#else) } ) = higher:: If :: hir( expr) ;
571
578
let if_body_expr = peel_blocks( then) ;
0 commit comments