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

Improve imports formatting #289

Merged
merged 5 commits into from
Dec 24, 2021
Merged

Improve imports formatting #289

merged 5 commits into from
Dec 24, 2021

Conversation

Robbepop
Copy link
Member

@Robbepop Robbepop commented Dec 24, 2021

Introduces the following rustfmt formatting configurations:

I have applied both formatting transformations in separate commits if you want to inspect their respective outcomes.
IMO it should not be a big deal to use nightly rustfmt toolchain instead of stable in our GitHub Actions CI.

I am aware that it is kinda biased to not apply standard stable Rust formatting and that introducing unstable formatting specifiers might be unpopular, however, both formatting specifiers have been "stable" for quite some time and are probably going to be stabilized as designed in the future.
Have imports merge automatically using imports_granuality instead of manually takes a lot of manual labor from developers.
The imports_layout formatting option makes Rust imports behave the same as everywhere else (e.g. in function arguments) which also conforms to a more unified formatting style.
Note: We are already using nightly Rust toolchain for clippy GitHub Actions CI.

A big advantage with vertical layouts is that Git diffs are more readable and provoke fewer merge conflicts.

There are some more nightly rustfmt options that we might want to explore using in the future in our CI, e.g.:

@codecov-commenter
Copy link

Codecov Report

Merging #289 (681b820) into master (dfd1eed) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #289   +/-   ##
=======================================
  Coverage   79.62%   79.62%           
=======================================
  Files          30       30           
  Lines        4756     4756           
=======================================
  Hits         3787     3787           
  Misses        969      969           
Impacted Files Coverage Δ
src/bin/instantiate.rs 0.00% <ø> (ø)
src/func.rs 50.00% <ø> (ø)
src/global.rs 68.18% <ø> (ø)
src/host.rs 66.66% <ø> (ø)
src/imports.rs 62.71% <ø> (ø)
src/lib.rs 27.27% <ø> (ø)
src/memory/mod.rs 75.87% <ø> (ø)
src/module.rs 73.96% <ø> (ø)
src/nan_preserving_float.rs 82.81% <ø> (ø)
src/prepare/compile.rs 77.83% <ø> (ø)
... and 11 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dfd1eed...681b820. Read the comment docs.

@Robbepop Robbepop requested a review from athei December 24, 2021 10:24
@Robbepop Robbepop merged commit aea0581 into master Dec 24, 2021
@pepyakin pepyakin deleted the rf-improve-imports-formatting branch December 24, 2021 12:21
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.

4 participants