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
This commit is contained in:
commit
221bf650f6
@ -449,6 +449,7 @@ fn check_must_use_candidate<'a, 'tcx>(
|
|||||||
|| mutates_static(cx, body)
|
|| mutates_static(cx, body)
|
||||||
|| in_external_macro(cx.sess(), item_span)
|
|| in_external_macro(cx.sess(), item_span)
|
||||||
|| returns_unit(decl)
|
|| returns_unit(decl)
|
||||||
|
|| !cx.access_levels.is_exported(item_id)
|
||||||
|| is_must_use_ty(cx, return_ty(cx, item_id))
|
|| is_must_use_ty(cx, return_ty(cx, item_id))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
Loading…
Reference in New Issue
Block a user