Skip to content

Commit 93a509f

Browse files
committed
exhaustive match instead of returns
1 parent b6b97a7 commit 93a509f

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

clippy_lints/src/operators/modulo_arithmetic.rs

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -60,31 +60,24 @@ fn analyze_operand(operand: &Expr<'_>, cx: &LateContext<'_>, expr: &Expr<'_>) ->
6060
Some(Constant::Int(v)) => match *cx.typeck_results().expr_ty(expr).kind() {
6161
ty::Int(ity) => {
6262
let value = sext(cx.tcx, v, ity);
63-
return Some(OperandInfo {
63+
Some(OperandInfo {
6464
string_representation: Some(value.to_string()),
6565
is_negative: value < 0,
6666
is_integral: true,
67-
});
67+
})
6868
},
69-
ty::Uint(_) => {
70-
return Some(OperandInfo {
71-
string_representation: None,
72-
is_negative: false,
73-
is_integral: true,
74-
});
75-
},
76-
_ => {},
69+
ty::Uint(_) => Some(OperandInfo {
70+
string_representation: None,
71+
is_negative: false,
72+
is_integral: true,
73+
}),
74+
_ => None,
7775
},
7876
// FIXME(f16_f128): add when casting is available on all platforms
79-
Some(Constant::F32(f)) => {
80-
return Some(floating_point_operand_info(&f));
81-
},
82-
Some(Constant::F64(f)) => {
83-
return Some(floating_point_operand_info(&f));
84-
},
85-
_ => {},
77+
Some(Constant::F32(f)) => Some(floating_point_operand_info(&f)),
78+
Some(Constant::F64(f)) => Some(floating_point_operand_info(&f)),
79+
_ => None,
8680
}
87-
None
8881
}
8982

9083
fn floating_point_operand_info<T: Display + PartialOrd + From<f32>>(f: &T) -> OperandInfo {

0 commit comments

Comments
 (0)