Skip to content

Commit 9ab6146

Browse files
committed
simplify unit type check
Signed-off-by: tabokie <[email protected]>
1 parent a5a6c95 commit 9ab6146

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

clippy_lints/src/map_unit_fn.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,7 @@ declare_clippy_lint! {
9797
declare_lint_pass!(MapUnit => [OPTION_MAP_UNIT_FN, RESULT_MAP_UNIT_FN]);
9898

9999
fn is_unit_type(ty: Ty<'_>) -> bool {
100-
match ty.kind() {
101-
ty::Tuple(slice) => slice.is_empty(),
102-
ty::Never => true,
103-
_ => false,
104-
}
100+
ty.is_unit() || ty.is_never()
105101
}
106102

107103
fn is_unit_function(cx: &LateContext<'_>, expr: &hir::Expr<'_>) -> bool {

0 commit comments

Comments
 (0)