mirror of
https://github.com/rust-lang/rust-clippy
synced 2025-02-16 05:58:41 +00:00
simplify unit type check
Signed-off-by: tabokie <xy.tao@outlook.com>
This commit is contained in:
parent
a5a6c95da8
commit
9ab6146afe
1 changed files with 1 additions and 5 deletions
|
@ -97,11 +97,7 @@ declare_clippy_lint! {
|
||||||
declare_lint_pass!(MapUnit => [OPTION_MAP_UNIT_FN, RESULT_MAP_UNIT_FN]);
|
declare_lint_pass!(MapUnit => [OPTION_MAP_UNIT_FN, RESULT_MAP_UNIT_FN]);
|
||||||
|
|
||||||
fn is_unit_type(ty: Ty<'_>) -> bool {
|
fn is_unit_type(ty: Ty<'_>) -> bool {
|
||||||
match ty.kind() {
|
ty.is_unit() || ty.is_never()
|
||||||
ty::Tuple(slice) => slice.is_empty(),
|
|
||||||
ty::Never => true,
|
|
||||||
_ => false,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fn is_unit_function(cx: &LateContext<'_>, expr: &hir::Expr<'_>) -> bool {
|
fn is_unit_function(cx: &LateContext<'_>, expr: &hir::Expr<'_>) -> bool {
|
||||||
|
|
Loading…
Add table
Reference in a new issue