diff options
| author | Lzu Tao <taolzu@gmail.com> | 2024-05-24 09:54:42 +0700 |
|---|---|---|
| committer | Lzu Tao <taolzu@gmail.com> | 2024-06-08 16:50:25 +0700 |
| commit | b161dc659c87df29cc9738a49105124ab30638e8 (patch) | |
| tree | 01f811fc306eee3071899235657c3a438de55cff /clippy_lints/src/default_numeric_fallback.rs | |
| parent | aff0e6d6d3aec4ce29af95a4dcf615650f1c5e4d (diff) | |
add utils is_inside_always_const_context
Diffstat (limited to 'clippy_lints/src/default_numeric_fallback.rs')
| -rw-r--r-- | clippy_lints/src/default_numeric_fallback.rs | 2 |
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 fbc4ede37b1..51252f59db4 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: &'tcx Body<'_>) { 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(_)) |
