We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent e2c96cc commit 2997070Copy full SHA for 2997070
compiler/rustc_lint/src/unused.rs
@@ -273,13 +273,11 @@ impl<'tcx> LateLintPass<'tcx> for UnusedResults {
273
expr: &hir::Expr<'_>,
274
span: Span,
275
) -> Option<MustUsePath> {
276
- if ty.is_unit()
277
- || !ty.is_inhabited_from(
278
- cx.tcx,
279
- cx.tcx.parent_module(expr.hir_id).to_def_id(),
280
- cx.typing_env(),
281
- )
282
- {
+ if ty.is_unit() {
+ return Some(MustUsePath::Suppressed);
+ }
+ let parent_mod_did = cx.tcx.parent_module(expr.hir_id).to_def_id();
+ if !ty.is_inhabited_from(cx.tcx, parent_mod_did, cx.typing_env()) {
283
return Some(MustUsePath::Suppressed);
284
}
285
0 commit comments