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.
10 Likes
ekuber
2
I think this makes sense. Please file a ticket for this.
1 Like
system
Closed
4
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.