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

Rust 2018 and code formatting #759

Merged
merged 16 commits into from May 13, 2019

Conversation

Projects
None yet
4 participants
@heftig
Copy link
Contributor

commented May 11, 2019

  • Port the code to Rust 2018. The output is untouched and still Rust 2015.
  • Format all the code! Used rustfmt nightly with merge_imports = true. This does not conflict with stable rustfmt.
@sdroege

This comment has been minimized.

Copy link
Member

commented May 11, 2019

👍 after fixing the merge conflicts. Thanks!

@heftig heftig force-pushed the heftig:2018+fmt branch from 4bb2446 to d029777 May 11, 2019

@heftig

This comment has been minimized.

Copy link
Contributor Author

commented May 11, 2019

Actually, found a few more things to do... one moment.

@heftig heftig force-pushed the heftig:2018+fmt branch 2 times, most recently from d490514 to c9e0873 May 11, 2019

@@ -30,3 +30,4 @@ build = "build.rs"
links = "atk"
name = "atk-sys"
version = "0.2.0"
edition = "2018"

This comment has been minimized.

Copy link
@EPashkin

EPashkin May 11, 2019

Member

Only in root Cargo.toml please

@EPashkin

This comment has been minimized.

Copy link
Member

commented May 11, 2019

@GuillaumeGomez What you think about this PR?

@heftig Thanks.
I only see 2 problems: wrongly added edition = "2018" to old generated code,
and mismatched usage of use: sometimes there 2 or more sections, separated by empty lines.
Maybe better combine and reformat it?
I don't sure, wherever it is better put "external uses" in separate section or not.

PS.
Seems first problem is actually not problem as travis passed.

@heftig heftig force-pushed the heftig:2018+fmt branch from c9e0873 to edf1184 May 11, 2019

@heftig

This comment has been minimized.

Copy link
Contributor Author

commented May 11, 2019

mismatched usage of use: sometimes there 2 or more sections, separated by empty lines.
Maybe better combine and reformat it?
I don't sure, wherever it is better put "external uses" in separate section or not.

Whatever you prefer. rustfmt doesn't (yet) reorder between sections. In the "Manually clean up imports" commit I reordered some manually to have external imports first, then internal ones, because this scheme was already in use in many files.

PS.
Seems first problem is actually not problem as travis passed.

I just removed the edition from the sub-projects, as requested. Should I undo this again?

@EPashkin

This comment has been minimized.

Copy link
Member

commented May 11, 2019

Thanks, I prefer edition only in one file, so no undo needed.
This PR is changing a lot. can you make only one use section too?

@heftig heftig force-pushed the heftig:2018+fmt branch 2 times, most recently from f3d7a3d to ba800f3 May 11, 2019

@heftig

This comment has been minimized.

Copy link
Contributor Author

commented May 11, 2019

Assuming AppVeyor passes, this should be done, now.

@GuillaumeGomez

This comment has been minimized.

Copy link
Member

commented May 11, 2019

A few PRs on gir are pending and rebasing them on this one would be a nightmare. Once things are settled down, it'll make sense but beforehand it'd very complicated.

@sdroege

This comment has been minimized.

Copy link
Member

commented May 12, 2019

Can we get this in then? :)

@GuillaumeGomez

This comment has been minimized.

Copy link
Member

commented May 12, 2019

Now that my PR has been merged, yes for sure. :)

@heftig

This comment has been minimized.

Copy link
Contributor Author

commented May 12, 2019

Does it need another rebase? I can do that once I'm on the train.

@EPashkin

This comment has been minimized.

Copy link
Member

commented May 12, 2019

@heftig Yes, please.
And fix or remove checks in apveyor.

heftig added some commits May 9, 2019

Format all the code!
Used rustfmt nightly with `merge_imports = true`. This does not conflict
with stable rustfmt, so the imports won't get unmerged again.
GStatus: Rename Generate_Builders
warning: variant `Generate_Builders` should have an upper camel case name
Reduce type complexity for group_by_user_data
warning: very complex type used. Consider factoring parts into `type` definitions

heftig added some commits May 11, 2019

@heftig heftig force-pushed the heftig:2018+fmt branch 2 times, most recently from cf770d0 to 3505ee1 May 12, 2019

@heftig

This comment has been minimized.

Copy link
Contributor Author

commented May 12, 2019

Added two new commits to deal with new warnings on master.

  • GStatus: Rename Generate_Builders
  • Reduce type complexity for group_by_user_data

@heftig heftig force-pushed the heftig:2018+fmt branch 2 times, most recently from a0b603a to 933ad6d May 12, 2019

@EPashkin
Copy link
Member

left a comment

@heftig Thanks
Only last nits about CI

- rustc -Vv
- cargo -Vv
- pacman --noconfirm -S mingw-w64-%ARCH%-gtk3 mingw-w64-%ARCH%-libgit2 mingw-w64-%ARCH%-libsecret

build_script:
- git clone -q https://github.com/gtk-rs/gir-files tests/gir-files
- IF "%RUST%" == "stable" cargo clippy --all --release
- IF "%RUST%" == "stable" cargo check --all --release

This comment has been minimized.

Copy link
@EPashkin

EPashkin May 13, 2019

Member

apveyor check only stables, so if don't needed,
You sure that cargo check can show something new after cargo clippy ?
Why is --all used, gir don't have workspaces.

This comment has been minimized.

Copy link
@heftig

heftig May 13, 2019

Author Contributor

No, I'm not sure. --all is from copying the invocations from somewhere else.

Show resolved Hide resolved .travis.yml Outdated

@heftig heftig force-pushed the heftig:2018+fmt branch from 933ad6d to 61701aa May 13, 2019

ci: Run fmt --check and clippy
Run clippy first to ensure the gir_version module is present. Otherwise
formatting would fail.

@heftig heftig force-pushed the heftig:2018+fmt branch from 61701aa to ea14f4d May 13, 2019

@EPashkin

This comment has been minimized.

Copy link
Member

commented May 13, 2019

cc @GuillaumeGomez, @sdroege just in case

@GuillaumeGomez
Copy link
Member

left a comment

Looks good to me!

@sdroege

This comment has been minimized.

Copy link
Member

commented May 13, 2019

👍

@sdroege

This comment has been minimized.

Copy link
Member

commented May 13, 2019

Next step: all our crates :)

@EPashkin

This comment has been minimized.

Copy link
Member

commented May 13, 2019

@heftig Thanks

@EPashkin EPashkin merged commit f10b0e5 into gtk-rs:master May 13, 2019

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.