rust-lang / rust-lang/rust-clippy

avoid-breaking-exported-api config should default to false for binary crates

Open
#10,689 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
13.5k
Forks
2.2k
Avg merge
2d 10h
Merged PRs (30d)
32

Description

Description

As it stands, the Clippy configuration variable avoid-breaking-exported-api defaults to true for binary crates. This probably doesn't make a lot of sense: binaries don't have an API, and it is not uncommon to have pub symbols in them for various reasons: most notably to temporarily suppress "unused" warnings during development.

I would suggest the default for binary crates should be false.

It is worth considering whether there should be a lint for exported API in binary crates. This would catch some unused code cases, as noted above. Let me know if I should file a separate issue for that.

Version
rustc 1.69.0 (84c898d65 2023-04-16)
binary: rustc
commit-hash: 84c898d65adf2f39a5a98507f1fe0ce10a2b8dbc
commit-date: 2023-04-16
host: x86_64-unknown-linux-gnu
release: 1.69.0
LLVM version: 15.0.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

Start by locating Clippy's handling of the avoid-breaking-exported-api configuration and how it determines whether a crate is binary or library. Inspect the existing tests for this configuration and crate type. Done means the default is false for binary crates while the library behavior remains unchanged, with tests covering the distinction.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.