question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add "reformat with rustfmt" action

See original GitHub issue

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
matkladcommented, Mar 14, 2016

If you invoke cargo fmt then it will look inside .cargo/bin regardless of PATH. To pass arguments to rustfmt, you can use --:

cargo fmt -- --skip_children 
0reactions
zjhmalecommented, Mar 15, 2016

@matklad one more question is that if i use rustfmt it will just format the specific file but if i use cargo fmt it will format the super mod file either, just like the verbose progress message shown below.

0:42:52 › λ -> cargo fmt -v -- --write-mode=overwrite --skip-children ./src/bar.rs
[Lib] "/Users/xxx/Documents/rustspace/phrase/src/lib.rs"
rustfmt --write-mode=overwrite --skip-children ./src/bar.rs /Users/zjh/Documents/rustspace/phrase/src/lib.rs
0:43:36 › λ -> rustfmt -v --write-mode=overwrite --skip-children ./src/bar.rs
Formatting ./src/bar.rs

is it an expected behavior here?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Rust - Code style and formatting - JetBrains Marketplace
To reformat a selection, you can only use the IDE formatter (see Reformat a selection for more information). To customize Rustfmt calls, navigate...
Read more >
Configuring Rustfmt
Rustfmt is able to pick up the edition used by reading the Cargo.toml file if executed through the Cargo's formatting tool cargo fmt...
Read more >
Rust format does not work with a very specific code structure
I've noticed rustfmt stopped working in my file. ... who will not work on my code does not seem like a reasonable course...
Read more >
Forced rustfmt is a roadblock to contributing - Rust Internals
rustfmt goes way beyond that to making formatting and AST relationship ... Here's some discussion about supporting that w\ GitHub Actions:.
Read more >
Automatically format and lint code with pre-commit - Interrupt
It took about 10 minutes to add pre-commit to our repo, and it helped me keep my patches clean and tidy! Why this...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found