diff options
author | Daniel Mueller <deso@posteo.net> | 2020-07-03 08:30:57 -0700 |
---|---|---|
committer | Daniel Mueller <deso@posteo.net> | 2020-07-03 08:30:57 -0700 |
commit | 6dd0dafdd53b990cfba79529a36352e11fe0385e (patch) | |
tree | 58fb4b1b2dba31476853fc2e937f391392f66367 /var | |
parent | 98855d442d70dc8ba40c1eb646132be43761c423 (diff) | |
download | nitrocli-6dd0dafdd53b990cfba79529a36352e11fe0385e.tar.gz nitrocli-6dd0dafdd53b990cfba79529a36352e11fe0385e.tar.bz2 |
Correctly use doc comments in macros
Our custom macros for conveniently creating types with additional meta
information for working with structopt do not actually use the doc
comments we have in place -- these comments are solely for in-source
documentation. We are an application and as such crates.io will not
automatically generate documentation.
All of that does not deter rustc from complaining that doc comments are
unused. In the past we tried to fudge that by adding a special
allowance, #[allow(unused_doc_comments)], but that seems to have seized
to work.
With this change we finally give in and move the doc comment into the
macro itself, where it will be used to annotate the generated type. This
step should hopefully silence rustc once and for all -- at the expense
of a slight decrease in readability.
Diffstat (limited to 'var')
-rw-r--r-- | var/shell-complete.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/var/shell-complete.rs b/var/shell-complete.rs index 4793ed3..a6f476d 100644 --- a/var/shell-complete.rs +++ b/var/shell-complete.rs @@ -28,7 +28,10 @@ mod nitrocli { // We only need a stripped down version of the `Command` macro. macro_rules! Command { - ( $name:ident, [ $( $(#[$doc:meta])* $var:ident$(($inner:ty))? => $exec:expr, ) *] ) => { + ( $(#[$docs:meta])* $name:ident, [ + $( $(#[$doc:meta])* $var:ident$(($inner:ty))? => $exec:expr, ) * + ] ) => { + $(#[$docs])* #[derive(Debug, PartialEq, structopt::StructOpt)] pub enum $name { $( |