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

2018-ification #444

Merged
merged 4 commits into from Apr 1, 2020
Merged

2018-ification #444

merged 4 commits into from Apr 1, 2020

Conversation

cole-h
Copy link
Member

@cole-h cole-h commented Apr 1, 2020

2018-ification changes include:

  • replacing extern crate imports (except for ones annotated with
    #[macro_use] to prevent touching more files; maybe in a follow-up)
  • removing standalone imports; for example, use serde_json; -- the
    code already uses serde_json::* where necessary

Minor formatting changes include:

  • collapsing imports from the same root (e.g. use std::io::Read; use std::io::BufRead -> use std::io::{BufRead, Read};
  • separating crate imports from external imports from std imports --
    this is how many project seem to order their imports, most notably the
    official Rust repo
  • moving some uses from the first line to below the file's doc comment
  • changing file-level doc comments from /// to //! (so they actually
    show up as documentation)
  • rustfmt messing with the nom macros in src/commentparser.rs

Most of the 2018-ification was done by cargo fix --edition-idioms, but
all changes were manually inspected to catch any detrimental changes,
and cargo test/cargo check still succeed.


Verified code impact (none) with cd ofborg && nix-shell ../shell.nix --run 'cargo check && cargo test'.

Supercedes #417.

Small note: when I ran cargo fix --edition-idioms, it introduced anonymous lifetimes (<'_>) to a few structs. I undid this change for the sole reason that I am still unfamiliar with lifetimes. rust_2018_idioms is the lint that notices this -- reason being: hidden lifetime parameters in types are deprecated. If this is desirable, I can add it back in (currently sitting in a git stash entry).

LnL7 and others added 4 commits March 31, 2020 19:29
With this we could add `edition = "2018"` to enable new features like
async/await.
2018-ification changes include:
* replacing `extern crate` imports (except for ones annotated with
`#[macro_use]` to prevent touching more files; maybe in a follow-up)
* removing standalone imports; for example, `use serde_json;` -- the
code already uses `serde_json::*` where necessary

Minor formatting changes include:
* collapsing imports from the same root (e.g. `use std::io::Read; use
std::io::BufRead` -> `use std::io::{BufRead, Read};`
* separating `crate` imports from external imports from `std` imports --
this is how many project seem to order their imports, most notably the
official Rust repo
* moving some `use`s from the first line to below the file's doc comment
* changing file-level doc comments from `///` to `//!` (so they actually
show up as documentation)
* `rustfmt` messing with the `nom` macros in `src/commentparser.rs`

Most of the 2018-ification was done by `cargo fix --edition-idioms`, but
all changes were manually inspected to catch any detrimental changes,
and `cargo test`/`cargo check` still succeed.
Ran `nix-shell -p carnix --run ./nix/update-carnix.sh`.
@grahamc
Copy link
Member

grahamc commented Apr 1, 2020

This is awesome, thank you so much!

@cole-h cole-h deleted the 2018 branch April 1, 2020 16:20
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.

None yet

3 participants