-
Notifications
You must be signed in to change notification settings - Fork 15
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
refactor: rust formatting #422
Conversation
According to the agreed upon Rust conventions.
1c43385
to
5a23d5a
Compare
* See `.github/workflows/rust.yml`
5a23d5a
to
ebde051
Compare
I would be much in favor of also adopting a consistent formatting of Edit: Moved to issue #431. |
@PhilippGackstatter let's delegate that to another PR. Could you create an issue to this end with this description (perhaps elaborating a bit futher also)? |
I would put them in the README. |
@@ -79,7 +79,7 @@ pub fn default_verifier_config( | |||
max_basic_blocks_in_script: None, | |||
max_per_fun_meter_units, | |||
max_per_mod_meter_units, | |||
max_idenfitier_len: protocol_config.max_move_identifier_len_as_option(), // Before protocol version 9, there was no limit | |||
max_idenfitier_len: protocol_config.max_move_identifier_len_as_option(), /* Before protocol version 9, there was no limit */ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we actually want to rewrite those comments with /* */
? I would prefer just //
although I dislike these same-line comments anyway, because they make the line so unnecessarily long.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Weird, was this automatic? I've never seen rustfmt do that before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that if normalize_comments
or wrap_comments
is true, this is the formatting result for comments in the same line.
This seems to be contrary to what one should expect from the normalize_comments. And surely not from wrap_comments
either.
I guess they don't call them unstable for nothing!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was this issue which was apparently resolved, but indeed, there might be an edge case with same line comments with these unstable options. I guess we just have to live with that side-effect or normalization and wrapping comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree. We can also add a new guideline to avoid same-line comments.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What? normalize_comments
specifically says the opposite:
Convert /* */ comments to // comments where possible
Converted to draft since there are a few issues to resolve:
|
Issues solved. See updated PR description. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
* refactor: update rustfmt.toml * refactor: apply cargo +nightly fmt * refactor: update rustfmt job in Rust workflow * refactor: fix pull_request trigger on rust.yml * refactor: use rolling nightly toolchain * refactor: use nightly rustfmt in scripts/execution_layer.py * refactor: update mysticeti,external workflows * refactor(sui-json-rpc-api): skip formatting of method argument comments * refactor: fix rustfmt check in external workflow * refactor: format external_crates/move * refactor(CI): trigger external workflow on develop * refactor: add Rust and fmt setup guidelines in README * refactor: remove suiop-cli format override
* refactor: update rustfmt.toml * refactor: apply cargo +nightly fmt * refactor: update rustfmt job in Rust workflow * refactor: fix pull_request trigger on rust.yml * refactor: use rolling nightly toolchain * refactor: use nightly rustfmt in scripts/execution_layer.py * refactor: update mysticeti,external workflows * refactor(sui-json-rpc-api): skip formatting of method argument comments * refactor: fix rustfmt check in external workflow * refactor: format external_crates/move * refactor(CI): trigger external workflow on develop * refactor: add Rust and fmt setup guidelines in README * refactor: remove suiop-cli format override
* refactor: update rustfmt.toml * refactor: apply cargo +nightly fmt * refactor: update rustfmt job in Rust workflow * refactor: fix pull_request trigger on rust.yml * refactor: use rolling nightly toolchain * refactor: use nightly rustfmt in scripts/execution_layer.py * refactor: update mysticeti,external workflows * refactor(sui-json-rpc-api): skip formatting of method argument comments * refactor: fix rustfmt check in external workflow * refactor: format external_crates/move * refactor(CI): trigger external workflow on develop * refactor: add Rust and fmt setup guidelines in README * refactor: remove suiop-cli format override
* refactor: update rustfmt.toml * refactor: apply cargo +nightly fmt * refactor: update rustfmt job in Rust workflow * refactor: fix pull_request trigger on rust.yml * refactor: use rolling nightly toolchain * refactor: use nightly rustfmt in scripts/execution_layer.py * refactor: update mysticeti,external workflows * refactor(sui-json-rpc-api): skip formatting of method argument comments * refactor: fix rustfmt check in external workflow * refactor: format external_crates/move * refactor(CI): trigger external workflow on develop * refactor: add Rust and fmt setup guidelines in README * refactor: remove suiop-cli format override
Description of change
This is a big patch that implements the formatting rules we agreed upon.
rustfmt.toml
external-crates/move/move-execution
.rust.yml
,external.yml
).scripts/execution_layer.py
to use the nightlyrustfmt
(@fijter please have a look)rustfmt
where it mangles with theopen_rpc
macro insui-json-rpc-api
crate.README.md
with Rust and formatting setup instructions.Links to any relevant issues
Fixes #396