Closed
Description
Given the following code:
#![warn(missing_docs)]
//! my test crate
/// foo.
#[cfg(debug_assertions)]
pub const FOO: () = ();
#[cfg(not(debug_assertions))]
pub const FOO: () = ();
fn main() {}
The current output is:
warning: missing documentation for a constant
--> src/main.rs:8:1
|
8 | pub const FOO: () = ();
| ^^^^^^^^^^^^^^^^^^^^^^^
|
note: the lint level is defined here
--> src/main.rs:1:9
|
1 | #![warn(missing_docs)]
| ^^^^^^^^^^^^
warning: `test_rust` (bin "test_rust") generated 1 warning
Finished release [optimized] target(s) in 0.00s
The above is only seen on release builds; on debug builds, no warning is output.
The doc comment should apply to whichever piece of code is actually compiled. Is there a way to achieve this without duplicating the comment?