diff --git a/src/librustc_lint/unused.rs b/src/librustc_lint/unused.rs index e5b818cd5fb5a..7773891b5d066 100644 --- a/src/librustc_lint/unused.rs +++ b/src/librustc_lint/unused.rs @@ -148,7 +148,13 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults { let ty_warned = match t.sty { ty::TyTuple(ref tys, _) if tys.is_empty() => return, ty::TyNever => return, - ty::TyAdt(def, _) => check_must_use(cx, def.did, s.span, ""), + ty::TyAdt(def, _) => { + if def.variants.is_empty() { + return; + } else { + check_must_use(cx, def.did, s.span, "") + } + }, _ => false, }; diff --git a/src/test/ui/issue-43806.rs b/src/test/ui/issue-43806.rs index df7f756127c4d..7757a503c7e87 100644 --- a/src/test/ui/issue-43806.rs +++ b/src/test/ui/issue-43806.rs @@ -12,15 +12,22 @@ #![deny(unused_results)] +enum Void {} + fn foo() {} fn bar() -> ! { loop {} } +fn baz() -> Void { + loop {} +} + fn qux() { foo(); bar(); + baz(); } fn main() {}