rust-lang / rust-lang/rust-clippy

redundant_pub_crate conflicts with pub use mod::*

Open
#13,676 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

C-bug I-false-positive
Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

Summary

Given this module:

mod foo;

pub use foo::*;

and the source file foo.rs:

pub(crate) fn bar() {}
pub fn baz() {}
pub fn qux() {}

After redundant_pub_crate is applied, pub(crate) fn bar becomes pub fn bar(), and because of the pub use foo::*, it becomes part of the public API, whereas previously it was crate private.

Lint Name

redundant_pub_crate

Reproducer

No response

Version
rustc 1.81.0 (eeb90cda1 2024-09-04)
binary: rustc
commit-hash: eeb90cda1969383f56a2637cbd3037bdf598841c
commit-date: 2024-09-04
host: aarch64-apple-darwin
release: 1.81.0
LLVM version: 18.1.7
Additional Labels

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Use the shown foo.rs module and pub use foo::* reproducer, then locate the redundant_pub_crate lint implementation and its tests in the Clippy source. Verify that applying the lint does not expose bar through the glob re-export; add a regression test covering the original and transformed visibility.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.