Skip to content

Commit 4fa994e

Browse files
committed
Address review comments
1 parent 883be6c commit 4fa994e

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/librustc_lint/unused.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,17 +242,17 @@ impl<'a, 'tcx> LateLintPass<'a, 'tcx> for UnusedResults {
242242
has_emitted
243243
}
244244
ty::Array(ty, len) => match len.try_eval_usize(cx.tcx, cx.param_env) {
245-
// If the array is definitely non-empty, we can do `#[must_use]` checking.
246-
Some(n) if n != 0 => {
245+
// Empty arrays won't contain any `#[must_use]` types.
246+
Some(0) => false,
247+
// If the array may be non-empty, we do `#[must_use]` checking.
248+
_ => {
247249
let descr_pre = &format!(
248250
"{}array{} of ",
249251
descr_pre,
250252
plural_suffix,
251253
);
252254
check_must_use_ty(cx, ty, expr, span, descr_pre, descr_post, true)
253255
}
254-
// Otherwise, we don't lint, to avoid false positives.
255-
_ => false,
256256
}
257257
_ => false,
258258
}

src/libstd/panicking.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,7 @@ pub fn set_hook(hook: Box<dyn Fn(&PanicInfo<'_>) + 'static + Sync + Send>) {
103103
HOOK_LOCK.write_unlock();
104104

105105
if let Hook::Custom(ptr) = old_hook {
106-
#[allow(unused_must_use)] {
107-
Box::from_raw(ptr);
108-
}
106+
mem::drop(Box::from_raw(ptr));
109107
}
110108
}
111109
}

0 commit comments

Comments
 (0)