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 structopt dependency by clap #5239

Merged
merged 1 commit into from
Apr 7, 2022
Merged

Replace structopt dependency by clap #5239

merged 1 commit into from
Apr 7, 2022

Conversation

Expyron
Copy link
Contributor

@Expyron Expyron commented Feb 25, 2022

StructOpt features have been integrated into clap v3, and it is now in maintenance mode.
The maintainer recommends migrating away from it: TeXitoi/structopt#525

This touches argument parsing for cargo fmt. The behavior was kept the same.

There are visual differences in the cargo fmt --help output.

cargo fmt --help before:

This utility formats all bin and lib files of the current crate using rustfmt.

USAGE:
    cargo fmt [FLAGS] [OPTIONS] [-- <rustfmt_options>...]

FLAGS:
        --check      Run rustfmt in check mode
        --all        Format all packages, and also their local path-based dependencies
    -h, --help       Prints help information
    -q, --quiet      No output printed to stdout
    -v, --verbose    Use verbose output
        --version    Print rustfmt version and exit

OPTIONS:
        --manifest-path <manifest-path>      Specify path to Cargo.toml
        --message-format <message-format>    Specify message-format: short|json|human
    -p, --package <package>...               Specify package to format

ARGS:
    <rustfmt_options>...    Options passed to rustfmt

cargo fmt --help after:

This utility formats all bin and lib files of the current crate using rustfmt.

USAGE:
    cargo fmt [OPTIONS] [-- <rustfmt_options>...]

ARGS:
    <rustfmt_options>...    Options passed to rustfmt

OPTIONS:
        --all
            Format all packages, and also their local path-based dependencies

        --check
            Run rustfmt in check mode

    -h, --help
            Print help information

        --manifest-path <manifest-path>
            Specify path to Cargo.toml

        --message-format <message-format>
            Specify message-format: short|json|human

    -p, --package <package>...
            Specify package to format

    -q, --quiet
            No output printed to stdout

    -v, --verbose
            Use verbose output

        --version
            Print rustfmt version and exit

@calebcartwright
Copy link
Member

Thank you for this. We discussed this at a dev tools meeting a couple months back so I've had this on my radar but obviously hadn't gotten around to it.

Working towards prepping the next release so probably going to wait to review and merge this till afterwards

@calebcartwright
Copy link
Member

Upstream changes from the subtree in r-l/rust have been pulled in and as anticipated there's now merge conflicts. Would you mind rebasing and resolving any conflicts when you get a chance?

@Expyron
Copy link
Contributor Author

Expyron commented Apr 7, 2022

Rebased and resolved the conflicts in Cargo.lock/Cargo.toml

Copy link
Contributor

@ytmimi ytmimi left a comment

Choose a reason for hiding this comment

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

Changes look good to me. Thanks for rebasing and fixing merge conflicts!

Copy link
Member

@calebcartwright calebcartwright left a comment

Choose a reason for hiding this comment

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

Thanks so much!

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.

3 participants