bheisler / criterion.rs

Statistics-driven benchmarking library for Rust
Apache License 2.0
4.28k stars 290 forks source link

Generate doc comment on benchmark runner in criterion_group macro #774

Open mcskware opened 2 months ago

mcskware commented 2 months ago

tl;dr: One-liner to add a doc comment to the generated benchmark runner fn from the criterion_group! macro.

The rustc lint missing-docs is triggered when using the criterion_group! macro. For users who specify the lint on their rustc command line, this can generate a warning that they are unable to quiet without an inner allow attribute (e.g. using #![allow(missing-docs)] at the head of their source file). This will surpress any other missing docs in their own code, which may be unexpected behavior.

I don't see any real downsides to this change, but I'm brand new to the criterion.rs codebase. Comments, discussion, and suggestions very welcome on this proposed change. For instance, I have no idea if this change warrants an entry in the changelog. Cheers!

mcskware commented 2 months ago

If there are any suggestions for what the generated comment should read, I'm happy to change that. The comment won't in general be visible, of course, but will show up when a user expands the macro. The current comment simply reads "The function which runs the benchmarks."