danielschemmel / build-info

Collects build-information of your Rust crate
https://crates.io/crates/build-info
24 stars 11 forks source link

[Feature Request]: Doc comments for build_info #20

Closed lexi-the-cute closed 7 months ago

lexi-the-cute commented 7 months ago

When using pub build_info, the missing doc comment warning comes up as I have a lint setup to enforce making sure I document everything

I would like the ability to specify the doc comment or have one auto-generated with the function

 alexis@framework  ~/Desktop/catgirl-engine   main  cargo check               
   Compiling catgirl-engine-client v0.2.0 (/home/alexis/Desktop/catgirl-engine/client)
   Compiling catgirl-engine v0.12.2 (/home/alexis/Desktop/catgirl-engine)
warning: missing documentation for a function
 --> client/src/setup.rs:4:1
  |
4 | build_info::build_info!(pub fn build_info);
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
note: the lint level is defined here
 --> client/src/lib.rs:3:9
  |
3 | #![warn(missing_docs)]
  |         ^^^^^^^^^^^^
  = note: this warning originates in the macro `$crate::proc::build_info` which comes from the expansion of the macro `build_info::build_info` (in Nightly builds, run with -Z macro-backtrace for more info)

warning: `catgirl-engine-client` (lib) generated 1 warning
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 1.43s
danielschemmel commented 7 months ago

As of 0.0.36, the following syntax should work for your use case:

build_info::build_info! {
    /// Public functions should really have a doc comment.
    pub fn function_name
}

I am not 100% happy about how this looks, but the doc comment needs to go inside the macro, and I am not seeing a really much better solution at the moment.