Skip to content

Commit d118e53

Browse files
committed
remove now dead code in ASSERTIONS_ON_CONSTANTS
cc rust-lang#11966
1 parent c7074de commit d118e53

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

clippy_lints/src/assertions_on_constants.rs

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
use clippy_utils::consts::{constant_with_source, Constant, ConstantSource};
1+
use clippy_utils::consts::{constant, Constant};
22
use clippy_utils::diagnostics::span_lint_and_help;
33
use clippy_utils::is_inside_always_const_context;
44
use clippy_utils::macros::{find_assert_args, root_macro_call_first_node, PanicExpn};
5-
use rustc_hir::{Expr, Item, ItemKind, Node};
5+
use rustc_hir::Expr;
66
use rustc_lint::{LateContext, LateLintPass};
77
use rustc_session::declare_lint_pass;
88
use rustc_span::sym;
@@ -47,17 +47,9 @@ impl<'tcx> LateLintPass<'tcx> for AssertionsOnConstants {
4747
let Some((condition, panic_expn)) = find_assert_args(cx, e, macro_call.expn) else {
4848
return;
4949
};
50-
let Some((Constant::Bool(val), source)) = constant_with_source(cx, cx.typeck_results(), condition) else {
50+
let Some(Constant::Bool(val)) = constant(cx, cx.typeck_results(), condition) else {
5151
return;
5252
};
53-
if let ConstantSource::Constant = source
54-
&& let Node::Item(Item {
55-
kind: ItemKind::Const(..),
56-
..
57-
}) = cx.tcx.parent_hir_node(e.hir_id)
58-
{
59-
return;
60-
}
6153
if val {
6254
span_lint_and_help(
6355
cx,

0 commit comments

Comments
 (0)