Skip to content

Commit 221bf65

Browse files
committed
Auto merge of #4886 - rust-lang:must-use-pub-only, r=phansch
Lint only exported must_use_candidates As promised on #4779, here's the check for publicly visible items for `must_use_candidate` changelog: none
2 parents b245fbd + a60177c commit 221bf65

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

clippy_lints/src/functions.rs

+1
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,7 @@ fn check_must_use_candidate<'a, 'tcx>(
449449
|| mutates_static(cx, body)
450450
|| in_external_macro(cx.sess(), item_span)
451451
|| returns_unit(decl)
452+
|| !cx.access_levels.is_exported(item_id)
452453
|| is_must_use_ty(cx, return_ty(cx, item_id))
453454
{
454455
return;

0 commit comments

Comments
 (0)