mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-17 06:28:42 +00:00
Fix dogfooding
This commit is contained in:
parent
748169deaa
commit
96ea5b2cd6
3 changed files with 6 additions and 15 deletions
|
@ -274,9 +274,7 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing<'tcx> {
|
|||
}
|
||||
|
||||
let typeck = cx.typeck_results();
|
||||
let (kind, sub_expr) = if let Some(x) = try_parse_ref_op(cx.tcx, typeck, expr) {
|
||||
x
|
||||
} else {
|
||||
let Some((kind, sub_expr)) = try_parse_ref_op(cx.tcx, typeck, expr) else {
|
||||
// The whole chain of reference operations has been seen
|
||||
if let Some((state, data)) = self.state.take() {
|
||||
report(cx, expr, state, data);
|
||||
|
|
|
@ -147,9 +147,8 @@ impl Constant {
|
|||
_ => None,
|
||||
},
|
||||
(&Self::Vec(ref l), &Self::Vec(ref r)) => {
|
||||
let cmp_type = match *cmp_type.kind() {
|
||||
ty::Array(ty, _) | ty::Slice(ty) => ty,
|
||||
_ => return None,
|
||||
let (ty::Array(cmp_type, _) | ty::Slice(cmp_type)) = *cmp_type.kind() else {
|
||||
return None
|
||||
};
|
||||
iter::zip(l, r)
|
||||
.map(|(li, ri)| Self::partial_cmp(tcx, cmp_type, li, ri))
|
||||
|
@ -401,10 +400,7 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> {
|
|||
use self::Constant::{Int, F32, F64};
|
||||
match *o {
|
||||
Int(value) => {
|
||||
let ity = match *ty.kind() {
|
||||
ty::Int(ity) => ity,
|
||||
_ => return None,
|
||||
};
|
||||
let ty::Int(ity) = *ty.kind() else { return None };
|
||||
// sign extend
|
||||
let value = sext(self.lcx.tcx, value, ity);
|
||||
let value = value.checked_neg()?;
|
||||
|
|
|
@ -131,13 +131,10 @@ impl HirEqInterExpr<'_, '_, '_> {
|
|||
([], None, [], None) => {
|
||||
// For empty blocks, check to see if the tokens are equal. This will catch the case where a macro
|
||||
// expanded to nothing, or the cfg attribute was used.
|
||||
let (left, right) = match (
|
||||
let (Some(left), Some(right)) = (
|
||||
snippet_opt(self.inner.cx, left.span),
|
||||
snippet_opt(self.inner.cx, right.span),
|
||||
) {
|
||||
(Some(left), Some(right)) => (left, right),
|
||||
_ => return true,
|
||||
};
|
||||
) else { return true };
|
||||
let mut left_pos = 0;
|
||||
let left = tokenize(&left)
|
||||
.map(|t| {
|
||||
|
|
Loading…
Add table
Reference in a new issue