Skip to content

Commit 23121cc

Browse files
committed
Fix dogfooding
1 parent b491315 commit 23121cc

File tree

3 files changed

+6
-15
lines changed

3 files changed

+6
-15
lines changed

clippy_lints/src/dereference.rs

+1-3
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,7 @@ impl<'tcx> LateLintPass<'tcx> for Dereferencing<'tcx> {
274274
}
275275

276276
let typeck = cx.typeck_results();
277-
let (kind, sub_expr) = if let Some(x) = try_parse_ref_op(cx.tcx, typeck, expr) {
278-
x
279-
} else {
277+
let Some((kind, sub_expr)) = try_parse_ref_op(cx.tcx, typeck, expr) else {
280278
// The whole chain of reference operations has been seen
281279
if let Some((state, data)) = self.state.take() {
282280
report(cx, expr, state, data);

clippy_utils/src/consts.rs

+3-7
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,8 @@ impl Constant {
147147
_ => None,
148148
},
149149
(&Self::Vec(ref l), &Self::Vec(ref r)) => {
150-
let cmp_type = match *cmp_type.kind() {
151-
ty::Array(ty, _) | ty::Slice(ty) => ty,
152-
_ => return None,
150+
let (ty::Array(cmp_type, _) | ty::Slice(cmp_type)) = *cmp_type.kind() else {
151+
return None
153152
};
154153
iter::zip(l, r)
155154
.map(|(li, ri)| Self::partial_cmp(tcx, cmp_type, li, ri))
@@ -401,10 +400,7 @@ impl<'a, 'tcx> ConstEvalLateContext<'a, 'tcx> {
401400
use self::Constant::{Int, F32, F64};
402401
match *o {
403402
Int(value) => {
404-
let ity = match *ty.kind() {
405-
ty::Int(ity) => ity,
406-
_ => return None,
407-
};
403+
let ty::Int(ity) = *ty.kind() else { return None };
408404
// sign extend
409405
let value = sext(self.lcx.tcx, value, ity);
410406
let value = value.checked_neg()?;

clippy_utils/src/hir_utils.rs

+2-5
Original file line numberDiff line numberDiff line change
@@ -131,13 +131,10 @@ impl HirEqInterExpr<'_, '_, '_> {
131131
([], None, [], None) => {
132132
// For empty blocks, check to see if the tokens are equal. This will catch the case where a macro
133133
// expanded to nothing, or the cfg attribute was used.
134-
let (left, right) = match (
134+
let (Some(left), Some(right)) = (
135135
snippet_opt(self.inner.cx, left.span),
136136
snippet_opt(self.inner.cx, right.span),
137-
) {
138-
(Some(left), Some(right)) => (left, right),
139-
_ => return true,
140-
};
137+
) else { return true };
141138
let mut left_pos = 0;
142139
let left = tokenize(&left)
143140
.map(|t| {

0 commit comments

Comments
 (0)