Skip to content

cargo fmt no longer accepts --write-mode overwrite after -- #2543

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

Closed
shepmaster opened this issue Mar 19, 2018 · 4 comments
Closed

cargo fmt no longer accepts --write-mode overwrite after -- #2543

shepmaster opened this issue Mar 19, 2018 · 4 comments

Comments

@shepmaster
Copy link
Member

shepmaster commented Mar 19, 2018

cargo fmt -- --write-mode overwrite

Invalid argument: `overwrite`.
usage: cargo fmt [options]

Options:
    -h, --help          show this message
    -q, --quiet         no output printed to stdout
    -v, --verbose       use verbose output
    -p, --package <package>
                        specify package to format (only usable in workspaces)
        --version       print rustfmt version and exit
        --all           format all packages (only usable in workspaces)

This utility formats all bin and lib files of the current crate using rustfmt. Arguments after `--` are passed to rustfmt.

This is preventing rustfmt from working in the Playground.

@shepmaster
Copy link
Member Author

Can reproduce outside of the playground:

$ cargo +nightly fmt -- --version
0.3.8-nightly (346238f4 2018-02-04)

$ cargo +nightly fmt -- --write-mode overwrite
Invalid argument: `overwrite`.
usage: cargo fmt [options]

$ rustup run nightly -- rustfmt --help | grep write
        --write-mode [replace|overwrite|display|plain|diff|coverage|checkstyle]

@shepmaster shepmaster changed the title Recent change broke formatting ability of the playground cargo fmt no longer accepts --write-mode overwrite after -- Mar 19, 2018
@shepmaster shepmaster changed the title cargo fmt no longer accepts --write-mode overwrite after -- cargo fmt no longer accepts --write-mode overwrite after -- Mar 19, 2018
@shepmaster
Copy link
Member Author

It appears that cargo +nightly fmt -- --write-mode=overwrite works, so perhaps something is trying to be overly clever about whitespace parsing?

shepmaster added a commit to rust-lang/rust-playground that referenced this issue Mar 20, 2018
@sinkuu
Copy link
Contributor

sinkuu commented Mar 21, 2018

This is rust-lang/cargo#5208

@nrc
Copy link
Member

nrc commented Mar 22, 2018

So this should be fixed now? (Or at least when the Cargo change hits nightly). Please comment if not.

@nrc nrc closed this as completed Mar 22, 2018
zzeroo added a commit to zzeroo/atom-rustfmt that referenced this issue Jan 10, 2019
rustfmt doesn't accept the parameter `--write-mode` anymore. See rust-lang/rustfmt#2543 for explanation.
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

No branches or pull requests

3 participants