Skip to content
/ rust Public
forked from rust-lang/rust

Commit b03864d

Browse files
committed
Auto merge of rust-lang#114729 - flip1995:clippyup, r=Manishearth
Update Clippy r? `@Manishearth` cc `@Centri3` This reinstates the `filter_map_bool_then` lint rust-lang#114715, since I think you fixed the ICE in rust-lang@beb57f0 which is included in this sync.
2 parents 08691f0 + 852bf4e commit b03864d

File tree

72 files changed

+1543
-378
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1543
-378
lines changed

src/tools/clippy/CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -4844,6 +4844,7 @@ Released 2018-09-13
48444844
[`field_reassign_with_default`]: https://rust-lang.github.io/rust-clippy/master/index.html#field_reassign_with_default
48454845
[`filetype_is_file`]: https://rust-lang.github.io/rust-clippy/master/index.html#filetype_is_file
48464846
[`filter_map`]: https://rust-lang.github.io/rust-clippy/master/index.html#filter_map
4847+
[`filter_map_bool_then`]: https://rust-lang.github.io/rust-clippy/master/index.html#filter_map_bool_then
48474848
[`filter_map_identity`]: https://rust-lang.github.io/rust-clippy/master/index.html#filter_map_identity
48484849
[`filter_map_next`]: https://rust-lang.github.io/rust-clippy/master/index.html#filter_map_next
48494850
[`filter_next`]: https://rust-lang.github.io/rust-clippy/master/index.html#filter_next
@@ -4889,12 +4890,14 @@ Released 2018-09-13
48894890
[`if_same_then_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#if_same_then_else
48904891
[`if_then_some_else_none`]: https://rust-lang.github.io/rust-clippy/master/index.html#if_then_some_else_none
48914892
[`ifs_same_cond`]: https://rust-lang.github.io/rust-clippy/master/index.html#ifs_same_cond
4893+
[`ignored_unit_patterns`]: https://rust-lang.github.io/rust-clippy/master/index.html#ignored_unit_patterns
48924894
[`impl_trait_in_params`]: https://rust-lang.github.io/rust-clippy/master/index.html#impl_trait_in_params
48934895
[`implicit_clone`]: https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone
48944896
[`implicit_hasher`]: https://rust-lang.github.io/rust-clippy/master/index.html#implicit_hasher
48954897
[`implicit_return`]: https://rust-lang.github.io/rust-clippy/master/index.html#implicit_return
48964898
[`implicit_saturating_add`]: https://rust-lang.github.io/rust-clippy/master/index.html#implicit_saturating_add
48974899
[`implicit_saturating_sub`]: https://rust-lang.github.io/rust-clippy/master/index.html#implicit_saturating_sub
4900+
[`impossible_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#impossible_comparisons
48984901
[`imprecise_flops`]: https://rust-lang.github.io/rust-clippy/master/index.html#imprecise_flops
48994902
[`inconsistent_digit_grouping`]: https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_digit_grouping
49004903
[`inconsistent_struct_constructor`]: https://rust-lang.github.io/rust-clippy/master/index.html#inconsistent_struct_constructor
@@ -5189,6 +5192,7 @@ Released 2018-09-13
51895192
[`redundant_closure`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure
51905193
[`redundant_closure_call`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_call
51915194
[`redundant_closure_for_method_calls`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_closure_for_method_calls
5195+
[`redundant_comparisons`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_comparisons
51925196
[`redundant_else`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_else
51935197
[`redundant_feature_names`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_feature_names
51945198
[`redundant_field_names`]: https://rust-lang.github.io/rust-clippy/master/index.html#redundant_field_names

src/tools/clippy/clippy_dev/src/main.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ fn main() {
4141
matches.get_one::<String>("type").map(String::as_str),
4242
matches.get_flag("msrv"),
4343
) {
44-
Ok(_) => update_lints::update(update_lints::UpdateMode::Change),
44+
Ok(()) => update_lints::update(update_lints::UpdateMode::Change),
4545
Err(e) => eprintln!("Unable to create lint: {e}"),
4646
}
4747
},

src/tools/clippy/clippy_dev/src/setup/vscode.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ fn check_install_precondition(force_override: bool) -> bool {
4747
}
4848
} else {
4949
match fs::create_dir(vs_dir_path) {
50-
Ok(_) => {
50+
Ok(()) => {
5151
println!("info: created `{VSCODE_DIR}` directory for clippy");
5252
},
5353
Err(err) => {
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
use std::borrow::Cow;
2-
31
use clippy_utils::diagnostics::span_lint_and_sugg;
42
use clippy_utils::msrvs::{self, Msrv};
3+
use clippy_utils::source::snippet_with_applicability;
54
use clippy_utils::sugg::Sugg;
6-
use if_chain::if_chain;
75
use rustc_errors::Applicability;
86
use rustc_hir::{Expr, ExprKind, Mutability, TyKind};
97
use rustc_lint::LateContext;
@@ -16,33 +14,41 @@ pub(super) fn check(cx: &LateContext<'_>, expr: &Expr<'_>, msrv: &Msrv) {
1614
return;
1715
}
1816

19-
if_chain! {
20-
if let ExprKind::Cast(cast_expr, cast_to_hir_ty) = expr.kind;
21-
let (cast_from, cast_to) = (cx.typeck_results().expr_ty(cast_expr), cx.typeck_results().expr_ty(expr));
22-
if let ty::RawPtr(TypeAndMut { mutbl: from_mutbl, .. }) = cast_from.kind();
23-
if let ty::RawPtr(TypeAndMut { ty: to_pointee_ty, mutbl: to_mutbl }) = cast_to.kind();
24-
if matches!((from_mutbl, to_mutbl),
25-
(Mutability::Not, Mutability::Not) | (Mutability::Mut, Mutability::Mut));
17+
if let ExprKind::Cast(cast_expr, cast_to_hir_ty) = expr.kind
18+
&& let (cast_from, cast_to) = (cx.typeck_results().expr_ty(cast_expr), cx.typeck_results().expr_ty(expr))
19+
&& let ty::RawPtr(TypeAndMut { mutbl: from_mutbl, .. }) = cast_from.kind()
20+
&& let ty::RawPtr(TypeAndMut { ty: to_pointee_ty, mutbl: to_mutbl }) = cast_to.kind()
21+
&& matches!((from_mutbl, to_mutbl),
22+
(Mutability::Not, Mutability::Not) | (Mutability::Mut, Mutability::Mut))
2623
// The `U` in `pointer::cast` have to be `Sized`
2724
// as explained here: https://github.com/rust-lang/rust/issues/60602.
28-
if to_pointee_ty.is_sized(cx.tcx, cx.param_env);
29-
then {
30-
let mut applicability = Applicability::MachineApplicable;
31-
let cast_expr_sugg = Sugg::hir_with_applicability(cx, cast_expr, "_", &mut applicability);
32-
let turbofish = match &cast_to_hir_ty.kind {
33-
TyKind::Infer => Cow::Borrowed(""),
34-
TyKind::Ptr(mut_ty) if matches!(mut_ty.ty.kind, TyKind::Infer) => Cow::Borrowed(""),
35-
_ => Cow::Owned(format!("::<{to_pointee_ty}>")),
36-
};
37-
span_lint_and_sugg(
38-
cx,
39-
PTR_AS_PTR,
40-
expr.span,
41-
"`as` casting between raw pointers without changing its mutability",
42-
"try `pointer::cast`, a safer alternative",
43-
format!("{}.cast{turbofish}()", cast_expr_sugg.maybe_par()),
44-
applicability,
45-
);
46-
}
25+
&& to_pointee_ty.is_sized(cx.tcx, cx.param_env)
26+
{
27+
let mut app = Applicability::MachineApplicable;
28+
let cast_expr_sugg = Sugg::hir_with_applicability(cx, cast_expr, "_", &mut app);
29+
let turbofish = match &cast_to_hir_ty.kind {
30+
TyKind::Infer => String::new(),
31+
TyKind::Ptr(mut_ty) => {
32+
if matches!(mut_ty.ty.kind, TyKind::Infer) {
33+
String::new()
34+
} else {
35+
format!(
36+
"::<{}>",
37+
snippet_with_applicability(cx, mut_ty.ty.span, "/* type */", &mut app)
38+
)
39+
}
40+
},
41+
_ => return,
42+
};
43+
44+
span_lint_and_sugg(
45+
cx,
46+
PTR_AS_PTR,
47+
expr.span,
48+
"`as` casting between raw pointers without changing its mutability",
49+
"try `pointer::cast`, a safer alternative",
50+
format!("{}.cast{turbofish}()", cast_expr_sugg.maybe_par()),
51+
app,
52+
);
4753
}
4854
}

src/tools/clippy/clippy_lints/src/declared_lints.rs

+4
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
203203
crate::if_let_mutex::IF_LET_MUTEX_INFO,
204204
crate::if_not_else::IF_NOT_ELSE_INFO,
205205
crate::if_then_some_else_none::IF_THEN_SOME_ELSE_NONE_INFO,
206+
crate::ignored_unit_patterns::IGNORED_UNIT_PATTERNS_INFO,
206207
crate::implicit_hasher::IMPLICIT_HASHER_INFO,
207208
crate::implicit_return::IMPLICIT_RETURN_INFO,
208209
crate::implicit_saturating_add::IMPLICIT_SATURATING_ADD_INFO,
@@ -337,6 +338,7 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
337338
crate::methods::EXPECT_USED_INFO,
338339
crate::methods::EXTEND_WITH_DRAIN_INFO,
339340
crate::methods::FILETYPE_IS_FILE_INFO,
341+
crate::methods::FILTER_MAP_BOOL_THEN_INFO,
340342
crate::methods::FILTER_MAP_IDENTITY_INFO,
341343
crate::methods::FILTER_MAP_NEXT_INFO,
342344
crate::methods::FILTER_NEXT_INFO,
@@ -516,6 +518,7 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
516518
crate::operators::FLOAT_CMP_CONST_INFO,
517519
crate::operators::FLOAT_EQUALITY_WITHOUT_ABS_INFO,
518520
crate::operators::IDENTITY_OP_INFO,
521+
crate::operators::IMPOSSIBLE_COMPARISONS_INFO,
519522
crate::operators::INEFFECTIVE_BIT_MASK_INFO,
520523
crate::operators::INTEGER_DIVISION_INFO,
521524
crate::operators::MISREFACTORED_ASSIGN_OP_INFO,
@@ -524,6 +527,7 @@ pub(crate) static LINTS: &[&crate::LintInfo] = &[
524527
crate::operators::NEEDLESS_BITWISE_BOOL_INFO,
525528
crate::operators::OP_REF_INFO,
526529
crate::operators::PTR_EQ_INFO,
530+
crate::operators::REDUNDANT_COMPARISONS_INFO,
527531
crate::operators::SELF_ASSIGNMENT_INFO,
528532
crate::operators::VERBOSE_BIT_MASK_INFO,
529533
crate::option_env_unwrap::OPTION_ENV_UNWRAP_INFO,

src/tools/clippy/clippy_lints/src/derive.rs

+17-33
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
1-
use clippy_utils::diagnostics::{
2-
span_lint_and_help, span_lint_and_note, span_lint_and_sugg, span_lint_and_then,
3-
};
1+
use clippy_utils::diagnostics::{span_lint_and_help, span_lint_and_note, span_lint_and_sugg, span_lint_and_then};
42
use clippy_utils::ty::{implements_trait, implements_trait_with_env, is_copy};
53
use clippy_utils::{is_lint_allowed, match_def_path, paths};
64
use if_chain::if_chain;
75
use rustc_errors::Applicability;
86
use rustc_hir::def_id::DefId;
97
use rustc_hir::intravisit::{walk_expr, walk_fn, walk_item, FnKind, Visitor};
108
use rustc_hir::{
11-
self as hir, BlockCheckMode, BodyId, Expr, ExprKind, FnDecl, Impl, Item, ItemKind,
12-
UnsafeSource, Unsafety,
9+
self as hir, BlockCheckMode, BodyId, Expr, ExprKind, FnDecl, Impl, Item, ItemKind, UnsafeSource, Unsafety,
1310
};
1411
use rustc_lint::{LateContext, LateLintPass};
1512
use rustc_middle::hir::nested_filter;
1613
use rustc_middle::traits::Reveal;
1714
use rustc_middle::ty::{
18-
self, ClauseKind, GenericArgKind, GenericParamDefKind, ImplPolarity, ParamEnv,
19-
ToPredicate, TraitPredicate, Ty, TyCtxt,
15+
self, ClauseKind, GenericArgKind, GenericParamDefKind, ImplPolarity, ParamEnv, ToPredicate, TraitPredicate, Ty,
16+
TyCtxt,
2017
};
2118
use rustc_session::{declare_lint_pass, declare_tool_lint};
2219
use rustc_span::def_id::LocalDefId;
@@ -207,10 +204,13 @@ declare_lint_pass!(Derive => [
207204

208205
impl<'tcx> LateLintPass<'tcx> for Derive {
209206
fn check_item(&mut self, cx: &LateContext<'tcx>, item: &'tcx Item<'_>) {
210-
if let ItemKind::Impl(Impl { of_trait: Some(ref trait_ref), .. }) = item.kind {
207+
if let ItemKind::Impl(Impl {
208+
of_trait: Some(ref trait_ref),
209+
..
210+
}) = item.kind
211+
{
211212
let ty = cx.tcx.type_of(item.owner_id).instantiate_identity();
212-
let is_automatically_derived =
213-
cx.tcx.has_attr(item.owner_id, sym::automatically_derived);
213+
let is_automatically_derived = cx.tcx.has_attr(item.owner_id, sym::automatically_derived);
214214

215215
check_hash_peq(cx, item.span, trait_ref, ty, is_automatically_derived);
216216
check_ord_partial_ord(cx, item.span, trait_ref, ty, is_automatically_derived);
@@ -327,12 +327,7 @@ fn check_ord_partial_ord<'tcx>(
327327
}
328328

329329
/// Implementation of the `EXPL_IMPL_CLONE_ON_COPY` lint.
330-
fn check_copy_clone<'tcx>(
331-
cx: &LateContext<'tcx>,
332-
item: &Item<'_>,
333-
trait_ref: &hir::TraitRef<'_>,
334-
ty: Ty<'tcx>,
335-
) {
330+
fn check_copy_clone<'tcx>(cx: &LateContext<'tcx>, item: &Item<'_>, trait_ref: &hir::TraitRef<'_>, ty: Ty<'tcx>) {
336331
let clone_id = match cx.tcx.lang_items().clone_trait() {
337332
Some(id) if trait_ref.trait_def_id() == Some(id) => id,
338333
_ => return,
@@ -350,9 +345,10 @@ fn check_copy_clone<'tcx>(
350345
if !is_copy(cx, ty) {
351346
if ty_subs.non_erasable_generics().next().is_some() {
352347
let has_copy_impl = cx.tcx.all_local_trait_impls(()).get(&copy_id).map_or(false, |impls| {
353-
impls
354-
.iter()
355-
.any(|&id| matches!(cx.tcx.type_of(id).instantiate_identity().kind(), ty::Adt(adt, _) if ty_adt.did() == adt.did()))
348+
impls.iter().any(|&id| {
349+
matches!(cx.tcx.type_of(id).instantiate_identity().kind(), ty::Adt(adt, _)
350+
if ty_adt.did() == adt.did())
351+
})
356352
});
357353
if !has_copy_impl {
358354
return;
@@ -431,14 +427,7 @@ struct UnsafeVisitor<'a, 'tcx> {
431427
impl<'tcx> Visitor<'tcx> for UnsafeVisitor<'_, 'tcx> {
432428
type NestedFilter = nested_filter::All;
433429

434-
fn visit_fn(
435-
&mut self,
436-
kind: FnKind<'tcx>,
437-
decl: &'tcx FnDecl<'_>,
438-
body_id: BodyId,
439-
_: Span,
440-
id: LocalDefId,
441-
) {
430+
fn visit_fn(&mut self, kind: FnKind<'tcx>, decl: &'tcx FnDecl<'_>, body_id: BodyId, _: Span, id: LocalDefId) {
442431
if self.has_unsafe {
443432
return;
444433
}
@@ -474,12 +463,7 @@ impl<'tcx> Visitor<'tcx> for UnsafeVisitor<'_, 'tcx> {
474463
}
475464

476465
/// Implementation of the `DERIVE_PARTIAL_EQ_WITHOUT_EQ` lint.
477-
fn check_partial_eq_without_eq<'tcx>(
478-
cx: &LateContext<'tcx>,
479-
span: Span,
480-
trait_ref: &hir::TraitRef<'_>,
481-
ty: Ty<'tcx>,
482-
) {
466+
fn check_partial_eq_without_eq<'tcx>(cx: &LateContext<'tcx>, span: Span, trait_ref: &hir::TraitRef<'_>, ty: Ty<'tcx>) {
483467
if_chain! {
484468
if let ty::Adt(adt, args) = ty.kind();
485469
if cx.tcx.visibility(adt.did()).is_public();

src/tools/clippy/clippy_lints/src/doc.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -716,10 +716,7 @@ fn check_code(cx: &LateContext<'_>, text: &str, edition: Edition, span: Span) {
716716
let sm = Lrc::new(SourceMap::new(FilePathMapping::empty()));
717717
let fallback_bundle =
718718
rustc_errors::fallback_fluent_bundle(rustc_driver::DEFAULT_LOCALE_RESOURCES.to_vec(), false);
719-
let emitter = EmitterWriter::new(
720-
Box::new(io::sink()),
721-
fallback_bundle,
722-
);
719+
let emitter = EmitterWriter::new(Box::new(io::sink()), fallback_bundle);
723720
let handler = Handler::with_emitter(Box::new(emitter)).disable_warnings();
724721
let sess = ParseSess::with_span_handler(handler, sm);
725722

src/tools/clippy/clippy_lints/src/eta_reduction.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ use rustc_hir::{BindingAnnotation, Expr, ExprKind, FnRetTy, Param, PatKind, QPat
1010
use rustc_infer::infer::TyCtxtInferExt;
1111
use rustc_lint::{LateContext, LateLintPass};
1212
use rustc_middle::ty::{
13-
self, Binder, ClosureArgs, ClosureKind, EarlyBinder, FnSig, GenericArg, GenericArgKind,
14-
GenericArgsRef, ImplPolarity, List, Region, RegionKind, Ty, TypeVisitableExt, TypeckResults,
13+
self, Binder, ClosureArgs, ClosureKind, EarlyBinder, FnSig, GenericArg, GenericArgKind, GenericArgsRef,
14+
ImplPolarity, List, Region, RegionKind, Ty, TypeVisitableExt, TypeckResults,
1515
};
1616
use rustc_session::{declare_lint_pass, declare_tool_lint};
1717
use rustc_span::symbol::sym;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
use clippy_utils::diagnostics::span_lint_and_sugg;
2+
use hir::PatKind;
3+
use rustc_errors::Applicability;
4+
use rustc_hir as hir;
5+
use rustc_lint::{LateContext, LateLintPass};
6+
use rustc_session::{declare_lint_pass, declare_tool_lint};
7+
8+
declare_clippy_lint! {
9+
/// ### What it does
10+
/// Checks for usage of `_` in patterns of type `()`.
11+
///
12+
/// ### Why is this bad?
13+
/// Matching with `()` explicitly instead of `_` outlines
14+
/// the fact that the pattern contains no data. Also it
15+
/// would detect a type change that `_` would ignore.
16+
///
17+
/// ### Example
18+
/// ```rust
19+
/// match std::fs::create_dir("tmp-work-dir") {
20+
/// Ok(_) => println!("Working directory created"),
21+
/// Err(s) => eprintln!("Could not create directory: {s}"),
22+
/// }
23+
/// ```
24+
/// Use instead:
25+
/// ```rust
26+
/// match std::fs::create_dir("tmp-work-dir") {
27+
/// Ok(()) => println!("Working directory created"),
28+
/// Err(s) => eprintln!("Could not create directory: {s}"),
29+
/// }
30+
/// ```
31+
#[clippy::version = "1.73.0"]
32+
pub IGNORED_UNIT_PATTERNS,
33+
pedantic,
34+
"suggest replacing `_` by `()` in patterns where appropriate"
35+
}
36+
declare_lint_pass!(IgnoredUnitPatterns => [IGNORED_UNIT_PATTERNS]);
37+
38+
impl<'tcx> LateLintPass<'tcx> for IgnoredUnitPatterns {
39+
fn check_pat(&mut self, cx: &LateContext<'tcx>, pat: &'tcx hir::Pat<'tcx>) {
40+
if matches!(pat.kind, PatKind::Wild) && cx.typeck_results().pat_ty(pat).is_unit() {
41+
span_lint_and_sugg(
42+
cx,
43+
IGNORED_UNIT_PATTERNS,
44+
pat.span,
45+
"matching over `()` is more explicit",
46+
"use `()` instead of `_`",
47+
String::from("()"),
48+
Applicability::MachineApplicable,
49+
);
50+
}
51+
}
52+
}

src/tools/clippy/clippy_lints/src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ mod future_not_send;
147147
mod if_let_mutex;
148148
mod if_not_else;
149149
mod if_then_some_else_none;
150+
mod ignored_unit_patterns;
150151
mod implicit_hasher;
151152
mod implicit_return;
152153
mod implicit_saturating_add;
@@ -1093,6 +1094,7 @@ pub fn register_plugins(store: &mut rustc_lint::LintStore, sess: &Session, conf:
10931094
})
10941095
});
10951096
store.register_late_pass(|_| Box::new(redundant_locals::RedundantLocals));
1097+
store.register_late_pass(|_| Box::new(ignored_unit_patterns::IgnoredUnitPatterns));
10961098
// add lints here, do not remove this comment, it's used in `new_lint`
10971099
}
10981100

src/tools/clippy/clippy_lints/src/loops/never_loop.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,9 @@ fn never_loop_expr<'tcx>(
162162
ExprKind::Binary(_, e1, e2)
163163
| ExprKind::Assign(e1, e2, _)
164164
| ExprKind::AssignOp(_, e1, e2)
165-
| ExprKind::Index(e1, e2, _) => never_loop_expr_all(cx, &mut [e1, e2].iter().copied(), ignore_ids, main_loop_id),
165+
| ExprKind::Index(e1, e2, _) => {
166+
never_loop_expr_all(cx, &mut [e1, e2].iter().copied(), ignore_ids, main_loop_id)
167+
},
166168
ExprKind::Loop(b, _, _, _) => {
167169
// Break can come from the inner loop so remove them.
168170
absorb_break(never_loop_block(cx, b, ignore_ids, main_loop_id))

src/tools/clippy/clippy_lints/src/manual_float_methods.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl<'tcx> LateLintPass<'tcx> for ManualFloatMethods {
8484
fn check_expr(&mut self, cx: &LateContext<'tcx>, expr: &'tcx Expr<'tcx>) {
8585
if !in_external_macro(cx.sess(), expr.span)
8686
&& (
87-
matches!(cx.tcx.constness(cx.tcx.hir().enclosing_body_owner(expr.hir_id)), Constness::NotConst)
87+
matches!(cx.tcx.constness(cx.tcx.hir().enclosing_body_owner(expr.hir_id)), Constness::NotConst)
8888
|| cx.tcx.features().active(sym!(const_float_classify))
8989
) && let ExprKind::Binary(kind, lhs, rhs) = expr.kind
9090
&& let ExprKind::Binary(lhs_kind, lhs_lhs, lhs_rhs) = lhs.kind

0 commit comments

Comments
 (0)