@@ -2,9 +2,10 @@ use clippy_utils::consts::{
22 constant, constant_simple, Constant ,
33 Constant :: { Int , F32 , F64 } ,
44} ;
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+ } ;
89use if_chain:: if_chain;
910use rustc_errors:: Applicability ;
1011use rustc_hir:: { BinOpKind , Expr , ExprKind , PathSegment , UnOp } ;
@@ -452,6 +453,9 @@ fn is_float_mul_expr<'a>(cx: &LateContext<'_>, expr: &'a Expr<'a>) -> Option<(&'
452453
453454// TODO: Fix rust-lang/rust-clippy#4735
454455fn 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+ }
455459 if let ExprKind :: Binary (
456460 Spanned {
457461 node : op @ ( BinOpKind :: Add | BinOpKind :: Sub ) ,
@@ -566,6 +570,9 @@ fn are_negated<'a>(cx: &LateContext<'_>, expr1: &'a Expr<'a>, expr2: &'a Expr<'a
566570}
567571
568572fn 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+ }
569576 if_chain ! {
570577 if let Some ( higher:: If { cond, then, r#else: Some ( r#else) } ) = higher:: If :: hir( expr) ;
571578 let if_body_expr = peel_blocks( then) ;
0 commit comments