Skip to content

Accept manifest path option #3023

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
wants to merge 28 commits into from
Closed

Accept manifest path option #3023

wants to merge 28 commits into from

Conversation

corasaurus-hex
Copy link
Contributor

Hi there!

Kind of a rust newbie here and I think I may have bitten off more than I can chew. I'm looking to solve #2817 and I'm struggling. I'd like to get cargo fmt --manifest-path working like cargo run --manifest-path but I'm not sure how to mesh it with the other strategies: CargoFmtStrategy::Root, CargoFmtStrategy::All, and CargoFmtStrategy::Some.

I guess what I'm stuck on is trying to understand the reasoning behind how those strategies work. There aren't any tests to reference so it's hard to dig up the reasons behind them, like what kind of project setups they're meant to be used with. I'd be happy to write up some tests for this once I can wrap my head around it. I think understanding that would help me add a new strategy.

Thoughts? Is this something you'd like to see in the project?

Thanks for your time and the awesome project!

Nathan Sutton added 2 commits September 14, 2018 00:55
The `getopts::Matches` struct has a `free` field containing all the args
not matched by the opts parser. Using this is much more reliable than
manually parsing the args a second time and getting false positives.
@nrc
Copy link
Member

nrc commented Sep 18, 2018

Yes! This would be nice to have.

CargoFmtStrategy is only relevant to formatting Cargo workspaces (which have multiple crates inside a single 'project'). I would probably change CargoFmtStrategy to a struct with a manifest_path: Option<PathBuf> field and a target_packages: Pacakges field, where Packages is a renamed version of the current CargoFmtStrategy.

Some tests for this would be nice, although they're tricky to make nice - ideally we wouldn't have lots of dummy projects as test data.

scampi and others added 26 commits September 20, 2018 18:42
Convert `#![doc]` and `#[doc]` attributes to `//!` and `///` doc comments.
when `normalize_doc_attributes` is off, they shouldn't be normalized to a doc comment
when `normalize_doc_attributes` is on, they shouldn't be affected
The other shapes of doc attributes shouldn't be normalized or modified.
The leading whitespace of a multine string was taken into account when
computing the `min_prefix_space_width`, even if that line couldn't be
trimmed. The consequence is it was always shifting the macro's content
to the right.
@corasaurus-hex
Copy link
Contributor Author

Aborting all of this and restarting in another branch because I'm awful at git rebasing. Thanks for the direction!

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.

9 participants