Skip to content

Commit

Permalink
Fix dogfooding
Browse files Browse the repository at this point in the history
  • Loading branch information
est31 committed Oct 24, 2022
1 parent edd2e17 commit 5d2b319
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
4 changes: 1 addition & 3 deletions clippy_lints/src/dereference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
10 changes: 3 additions & 7 deletions clippy_utils/src/consts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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()?;
Expand Down
7 changes: 2 additions & 5 deletions clippy_utils/src/hir_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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| {
Expand Down

0 comments on commit 5d2b319

Please sign in to comment.