about summary refs log tree commit diff
path: root/clippy_lints/src/default_numeric_fallback.rs
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2024-07-01 22:06:06 +0000
committerbors <bors@rust-lang.org>2024-07-01 22:06:06 +0000
commitc4125286cea8a4dcbb5df0e05f0d968a7d0c59d0 (patch)
tree41dbeb245fde8138a461512a6c27d5c7832e30d6 /clippy_lints/src/default_numeric_fallback.rs
parent0505dad349077be3670816c08b0ba9fd45aff4b3 (diff)
parenta0234b4e8b8c58a8726ec64828c7144c910faf67 (diff)
Auto merge of #12840 - tesuji:const-asserts, r=llogiq
Don't lint `assertions_on_constants` on any const assertions

close #12816
close #12847
cc #12817

----

changelog: Fix false positives in consts for `assertions_on_constants` and `unnecessary_operation`.
Diffstat (limited to 'clippy_lints/src/default_numeric_fallback.rs')
-rw-r--r--clippy_lints/src/default_numeric_fallback.rs2
1 files changed, 2 insertions, 0 deletions
diff --git a/clippy_lints/src/default_numeric_fallback.rs b/clippy_lints/src/default_numeric_fallback.rs
index ff631909bcb..9af73db6849 100644
--- a/clippy_lints/src/default_numeric_fallback.rs
+++ b/clippy_lints/src/default_numeric_fallback.rs
@@ -50,6 +50,8 @@ declare_lint_pass!(DefaultNumericFallback => [DEFAULT_NUMERIC_FALLBACK]);
 impl<'tcx> LateLintPass<'tcx> for DefaultNumericFallback {
     fn check_body(&mut self, cx: &LateContext<'tcx>, body: &Body<'tcx>) {
         let hir = cx.tcx.hir();
+        // NOTE: this is different from `clippy_utils::is_inside_always_const_context`.
+        // Inline const supports type inference.
         let is_parent_const = matches!(
             hir.body_const_context(hir.body_owner_def_id(body.id())),
             Some(ConstContext::Const { inline: false } | ConstContext::Static(_))