-
Notifications
You must be signed in to change notification settings - Fork 14.1k
Open
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-visibilityArea: Visibility / privacyArea: Visibility / privacyC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.L-dead_codeLint: dead_codeLint: dead_codeT-langRelevant to the language teamRelevant to the language team
Description
(copy-pasting from IRLO)
Consider the code snippet
pub fn foo() {
// unused function!
}
fn main() {}cargo check reports no errors or warnings. However, the same snippet using pub(crate) fn foo() gives a warning:
warning: function is never used: `foo`
--> src/main.rs:1:15
|
1 | pub(crate) fn foo() {
| ^^^
|
= note: `#[warn(dead_code)]` on by default
warning: 1 warning emitted
Given that binaries can't be used in anything else (as far as I'm aware?), would it make sense to treat pub as equivalent to pub(crate) in binaries? I don't believe there is any difference in semantics, but it certainly makes a difference regarding warnings.
CC @estebank, who suggested I file an issue.
estebank, kpreid, strohel, WiSaGaN, martin-t and 30 more
Metadata
Metadata
Assignees
Labels
A-lintsArea: Lints (warnings about flaws in source code) such as unused_mut.Area: Lints (warnings about flaws in source code) such as unused_mut.A-visibilityArea: Visibility / privacyArea: Visibility / privacyC-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.L-dead_codeLint: dead_codeLint: dead_codeT-langRelevant to the language teamRelevant to the language team