Auto merge of #8183 - alex-ozdemir:limit-ident, r=camsteffen

Limit the ``[`identity_op`]`` lint to integral operands.

changelog: limit ``[`identity_op`]`` to integral operands

In the ``[`identity_op`]`` lint, if the operands are non-integers, then the lint is likely
wrong.
This commit is contained in:
bors 2021-12-28 22:01:57 +00:00
commit 16ef044e72
4 changed files with 56 additions and 18 deletions

View file

@ -168,6 +168,14 @@ impl Constant {
None
}
}
#[must_use]
pub fn peel_refs(mut self) -> Self {
while let Constant::Ref(r) = self {
self = *r;
}
self
}
}
/// Parses a `LitKind` to a `Constant`.