Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documenting flattened fields? #411

Closed
leeola opened this issue Jul 24, 2020 · 1 comment · Fixed by #414
Closed

Documenting flattened fields? #411

leeola opened this issue Jul 24, 2020 · 1 comment · Fixed by #414
Assignees

Comments

@leeola
Copy link

leeola commented Jul 24, 2020

I'm trying to write Cargo documentation for a field that is flattened by structopt. This seems to be rejected as a compile-time error, via:

error: proc-macro derive panicked
  --> foo/src/serve.rs:12:10
   |
12 | #[derive(StructOpt, Debug)]
   |          ^^^^^^^^^
   |
   = help: message: methods and doc comments are not allowed for flattened entry

error: aborting due to previous error

I imagine StructOpt chose this behavior for automatically generated --help, however this directly conflicts with clippy lints that require documentation. Ie, i can't merge this structopt code as it either fails clippy lints or fails to compile due to StructOpt.

Is there a way to disable this compilation failure? Ie, ignore the flattened field's documentation? Maybe something like a structopt(flatten, ignore_documentation) attribute?

@CreepySkeleton CreepySkeleton self-assigned this Jul 24, 2020
@CreepySkeleton
Copy link
Collaborator

I think we can just ignore the doc comments on top of #[flatten/subcommand] fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants