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

Replace proc-macro-error with proc-macro2-diagnostics #536

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

tamird
Copy link

@tamird tamird commented Jan 7, 2024

See individual commits.

I realize this crate is deprecated in favor of clap, but it still seems to
enjoy some 10,000-40,000 downloads per day over the past three months. Updating
to syn@2 is likely to have positive effect on compilation time for dependents.

See https://crates.io/crates/structopt-derive for download graphs.

```
TRYBUILD=overwrite cargo test
```
```
warning: unnecessary parentheses around match arm expression
   --> structopt-derive/src/parse.rs:177:28
    |
177 |                 "about" => (Ok(About(name, None))),
    |                            ^                     ^
    |
    = note: `#[warn(unused_parens)]` on by default
help: remove these parentheses
    |
177 -                 "about" => (Ok(About(name, None))),
177 +                 "about" => Ok(About(name, None)),
    |

warning: unnecessary parentheses around match arm expression
   --> structopt-derive/src/parse.rs:178:29
    |
178 |                 "author" => (Ok(Author(name, None))),
    |                             ^                      ^
    |
help: remove these parentheses
    |
178 -                 "author" => (Ok(Author(name, None))),
178 +                 "author" => Ok(Author(name, None)),
    |
```
```
warning: the following explicit lifetimes could be elided: 'a
    --> src/lib.rs:1205:24
     |
1205 |     fn from_subcommand<'a, 'b>(_sub: (&'b str, Option<&'b clap::ArgMatches<'a>>)) -> Option<Self>
     |                        ^^                                                  ^^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
     = note: `#[warn(clippy::needless_lifetimes)]` on by default
help: elide the lifetimes
     |
1205 -     fn from_subcommand<'a, 'b>(_sub: (&'b str, Option<&'b clap::ArgMatches<'a>>)) -> Option<Self>
1205 +     fn from_subcommand<'b>(_sub: (&'b str, Option<&'b clap::ArgMatches<'_>>)) -> Option<Self>
     |

warning: the following explicit lifetimes could be elided: 'a
    --> src/lib.rs:1230:24
     |
1230 |     fn from_subcommand<'a, 'b>(sub: (&'b str, Option<&'b clap::ArgMatches<'a>>)) -> Option<Self> {
     |                        ^^                                                 ^^
     |
     = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#needless_lifetimes
help: elide the lifetimes
     |
1230 -     fn from_subcommand<'a, 'b>(sub: (&'b str, Option<&'b clap::ArgMatches<'a>>)) -> Option<Self> {
1230 +     fn from_subcommand<'b>(sub: (&'b str, Option<&'b clap::ArgMatches<'_>>)) -> Option<Self> {
     |
```
proc-macro-error is unmaintained, and structopt-derive is by far its
most popular dependent. See
https://crates.io/crates/proc-macro-error/reverse_dependencies.
@tamird
Copy link
Author

tamird commented Mar 14, 2024

@TeXitoi could you have a look please?

@TeXitoi
Copy link
Owner

TeXitoi commented Mar 14, 2024

That’s a big change for a frozen crate. I’ll try to have a look, but no promise.

@@ -1,18 +1,10 @@
error: `#[structopt(raw(...))` attributes are removed in structopt 0.3, they are replaced with raw methods

= help: if you meant to call `clap::Arg::raw()` method you should use bool literal, like `raw(true)` or `raw(false)`
= note: if you need to call `clap::Arg/App::case_insensitive` method you can do it like this: #[structopt(case_insensitive = true)]
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a regression

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, and one that I've called out here.

@epage
Copy link
Contributor

epage commented Mar 14, 2024

I realize this crate is deprecated in favor of clap, but it still seems to
enjoy some 10,000-40,000 downloads per day over the past three months. Updating
to syn@2 is likely to have positive effect on compilation time for dependents.

imo that effort would be better spent migrating some of the more popular users.

@tamird
Copy link
Author

tamird commented Mar 14, 2024

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 this pull request may close these issues.

None yet

3 participants