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`.
This commit is contained in:
commit
c4125286ce
9 changed files with 105 additions and 22 deletions
|
|
@ -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(_))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue