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

Reformat all comments using rustfmt #29

Merged
merged 3 commits into from
Jun 14, 2022
Merged

Conversation

SUPERCILEX
Copy link
Contributor

No description provided.

Copy link
Owner

@djeedai djeedai left a comment

Choose a reason for hiding this comment

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

Sorry for the delay. That looks good. Out of curiosity is there any specific config you used? I generally have VS Code auto-format all the time, so I'm surprised there's so many comments not formatted. Did you make some local changes to the rustfmt config?

@djeedai
Copy link
Owner

djeedai commented Jun 12, 2022

I'm getting no change at all with cargo fmt --all. How did you format those comments? Also, the README for rustfmt says it doesn't format comments : https://github.com/rust-lang/rustfmt

@SUPERCILEX
Copy link
Contributor Author

Yeah, it's a nightly configuration: https://rust-lang.github.io/rustfmt/?version=master&search=wrap_c#wrap_comments.

@djeedai
Copy link
Owner

djeedai commented Jun 12, 2022

Can you please add the rustfmt.toml file to the PR, so others can replicate this? Even with wrap_comments I don't get the same result, seems there are other options you used, like moving the comment on the previous line if it's too long to be inline.

@djeedai
Copy link
Owner

djeedai commented Jun 12, 2022

Ah I guess I need also unstable_features = true, so some rustfmt.toml like:

unstable_features = true
wrap_comments=true

Signed-off-by: Alex Saveau <[email protected]>
@SUPERCILEX
Copy link
Contributor Author

Does unstable_features work?

I did have to manually edit the example comments and your right my rustfmt had an extra config for imports.

@SUPERCILEX
Copy link
Contributor Author

Hmmm, I'm not sure CI is actually set up to check clippy or fmt. I get tons of errors:

$ cargo +stable fmt
Warning: can't set `wrap_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `imports_granularity = Crate`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.
Warning: can't set `wrap_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `imports_granularity = Crate`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.
Warning: can't set `wrap_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `imports_granularity = Crate`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.
Warning: can't set `wrap_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `imports_granularity = Crate`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.
Warning: can't set `wrap_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `imports_granularity = Crate`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.
Warning: can't set `wrap_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `imports_granularity = Crate`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.
Warning: can't set `wrap_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `imports_granularity = Crate`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.
Warning: can't set `wrap_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `imports_granularity = Crate`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.
Warning: can't set `wrap_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `imports_granularity = Crate`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.
Warning: can't set `wrap_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `imports_granularity = Crate`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.
Warning: can't set `wrap_comments = true`, unstable features are only available in nightly channel.
Warning: can't set `imports_granularity = Crate`, unstable features are only available in nightly channel.
Warning: can't set `unstable_features = true`, unstable features are only available in nightly channel.

@djeedai
Copy link
Owner

djeedai commented Jun 13, 2022

Ah yes obviously if we add some unstable feature to rustfmt.toml then it doesn't build anymore in stable... I wonder if we can pass those args on the command line for unstable CI only?

@djeedai
Copy link
Owner

djeedai commented Jun 13, 2022

Does unstable_features work?

I did have to manually edit the example comments and your right my rustfmt had an extra config for imports.

Also yes the config I pasted worked for me without any additional settings. I upgraded Rust to latest first, then ran cargo +nightly fmt --all from the root of the repository. I didn't need the granularity thing.

This reverts commit b8ecee0.
@SUPERCILEX
Copy link
Contributor Author

Ah yes obviously if we add some unstable feature to rustfmt.toml then it doesn't build anymore in stable... I wonder if we can pass those args on the command line for unstable CI only?

Probably, but can that be done in another PR?

@djeedai djeedai merged commit cc3105d into djeedai:main Jun 14, 2022
@SUPERCILEX SUPERCILEX deleted the comments branch June 14, 2022 12:27
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.

2 participants