-
Notifications
You must be signed in to change notification settings - Fork 116
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
2024: rustfmt style edition #331
Conversation
Projects who have contributors that may utilize their editor's format-on-save | ||
features are also strongly encouraged to add a `.rustfmt.toml` file to their project | ||
that includes the corresponding `style_edition` utilized within their project, or to | ||
encourage their users to ensure their local editor format-on-save feature is | ||
configured to use that same `style_edition`. | ||
|
||
This is to ensure that the editor format-on-save output is consistent with the | ||
output when `cargo fmt` is manually executed by the developer, or the project's CI | ||
process (many editors will run `rustfmt` directly which by default uses the 2015 | ||
edition, whereas `cargo fmt` uses the edition specified in the `Cargo.toml` file) |
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'm curious whether folks think this is relevant enough to include in the guide, and if so, whether this is sufficiently clear?
This is an existing situation for projects that use the format-on-save behavior when working on code that needs edition 2018 or 2021 for rustc parsing, but in those situations the editor would surface up the rustfmt error or do nothing.
With this edition, if a user/project sets the edition to 2024 in their Cargo.toml, and does nothing else, they could trigger a format-on-save from their editor, then manually run a cargo fmt --check
that would fail because the two were running rustfmt
with different style editions (or alternatively they run format-on-save in their editor and then push and see their CI fail).
This would only happen if the codebase happens to contain code that gets formatted differently across style editions, but it seems like a sufficiently plausible scenario worth getting in front of in my opinion
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 think it is good to include it.
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.
Thanks!
Update books ## rust-lang/edition-guide 3 commits in 1f07c242f8162a711a5ac5a4ea8fa7ec884ee7a9..2d482e203eb6d6e353814cf1415c5f94e590b9e0 2024-11-04 14:42:36 UTC to 2019-06-14 21:27:05 UTC - 2024: rustfmt style edition (rust-lang/edition-guide#331) - rustdoc: Fix doctest `include` paths (rust-lang/edition-guide#329) - docs(cargo): Cover MSRV-aware resolver (rust-lang/edition-guide#328) ## rust-lang/reference 3 commits in 23ce619966541bf2c80d45fdfeecf3393e360a13..da0f6dad767670da0e8cd5af8a7090db3272f626 2024-11-01 12:52:51 UTC to 2024-10-30 13:30:17 UTC - fix typo referring to 'Unsize' trait (rust-lang/reference#1669) - Add identifier syntax to items.md and subchapters (rust-lang/reference#1599) - Rename "object safe" to "dyn compatible" (rust-lang/reference#1666) ## rust-lang/rust-by-example 5 commits in 8bede1b919a81ab7d0c961f6bbf68d3efa297bd2..9db78608b17d5f4a6c033b8a3038466b87d63206 2024-10-31 21:03:20 UTC to 2024-10-26 16:06:05 UTC - fix(doc): correct small errors in pipes.md (rust-lang/rust-by-example#1894) - Fix ambiguous comment on 2.3 Arrays and Slices page (rust-lang/rust-by-example#1885) - Fix typo in generics/new_types (rust-lang/rust-by-example#1892) - docs(zh): fix known issues (rust-lang/rust-by-example#1891) - `read_lines`: Use `.map_while(Result::ok)` instead of `.flatten()`. (rust-lang/rust-by-example#1890) ## rust-lang/rustc-dev-guide 22 commits in 59d94ea..6a5accd 2024-11-04 14:40:57 UTC to 2024-10-24 20:33:08 UTC - Add a link for the `reference` compiletest header (rust-lang/rustc-dev-guide#2096) - Slightly fix up the glossary (rust-lang/rustc-dev-guide#2127) - Remove an mdbook workaround (rust-lang/rustc-dev-guide#2124) - Fix broken links (rust-lang/rustc-dev-guide#2123) - Fix minicore.rs link (rust-lang/rustc-dev-guide#2122) - Update for recent dataflow simplifications. (rust-lang/rustc-dev-guide#2121) - Describe `minicore` test auxiliary and directive (rust-lang/rustc-dev-guide#2097) - Fix and update docs for `needs-force-clang-based-tests` (rust-lang/rustc-dev-guide#2085) - Add redirects for integration-testing and headers (rust-lang/rustc-dev-guide#2092) - Fix borked links (rust-lang/rustc-dev-guide#2119) - Describe how to revert a PR (rust-lang/rustc-dev-guide#2118) - Linkify the footnotes in the async closure chapter (rust-lang/rustc-dev-guide#2117) - Try to fix footnotes (rust-lang/rustc-dev-guide#2115) - Fix rustc-related links that are 404 right now (rust-lang/rustc-dev-guide#2112) - Async closures chapter (rust-lang/rustc-dev-guide#2110) - update rfl ci job policy (rust-lang/rustc-dev-guide#2108) - Fix internal and incomplete links (rust-lang/rustc-dev-guide#2107) - Describe why and how to use a separate build directory for rust-analyzer (rust-lang/rustc-dev-guide#2106) - Update current status of diagnostics translation infra (rust-lang/rustc-dev-guide#2105) - update const stability docs (rust-lang/rustc-dev-guide#2098) - Advice on auto-formatting C++ code (rust-lang/rustc-dev-guide#2104) - Update compiler-src.md (rust-lang/rustc-dev-guide#2102)
Update books ## rust-lang/edition-guide 3 commits in 1f07c242f8162a711a5ac5a4ea8fa7ec884ee7a9..2d482e203eb6d6e353814cf1415c5f94e590b9e0 2024-11-04 14:42:36 UTC to 2019-06-14 21:27:05 UTC - 2024: rustfmt style edition (rust-lang/edition-guide#331) - rustdoc: Fix doctest `include` paths (rust-lang/edition-guide#329) - docs(cargo): Cover MSRV-aware resolver (rust-lang/edition-guide#328) ## rust-lang/reference 3 commits in 23ce619966541bf2c80d45fdfeecf3393e360a13..da0f6dad767670da0e8cd5af8a7090db3272f626 2024-11-01 12:52:51 UTC to 2024-10-30 13:30:17 UTC - fix typo referring to 'Unsize' trait (rust-lang/reference#1669) - Add identifier syntax to items.md and subchapters (rust-lang/reference#1599) - Rename "object safe" to "dyn compatible" (rust-lang/reference#1666) ## rust-lang/rust-by-example 5 commits in 8bede1b919a81ab7d0c961f6bbf68d3efa297bd2..9db78608b17d5f4a6c033b8a3038466b87d63206 2024-10-31 21:03:20 UTC to 2024-10-26 16:06:05 UTC - fix(doc): correct small errors in pipes.md (rust-lang/rust-by-example#1894) - Fix ambiguous comment on 2.3 Arrays and Slices page (rust-lang/rust-by-example#1885) - Fix typo in generics/new_types (rust-lang/rust-by-example#1892) - docs(zh): fix known issues (rust-lang/rust-by-example#1891) - `read_lines`: Use `.map_while(Result::ok)` instead of `.flatten()`. (rust-lang/rust-by-example#1890) ## rust-lang/rustc-dev-guide 22 commits in 59d94ea..6a5accd 2024-11-04 14:40:57 UTC to 2024-10-24 20:33:08 UTC - Add a link for the `reference` compiletest header (rust-lang/rustc-dev-guide#2096) - Slightly fix up the glossary (rust-lang/rustc-dev-guide#2127) - Remove an mdbook workaround (rust-lang/rustc-dev-guide#2124) - Fix broken links (rust-lang/rustc-dev-guide#2123) - Fix minicore.rs link (rust-lang/rustc-dev-guide#2122) - Update for recent dataflow simplifications. (rust-lang/rustc-dev-guide#2121) - Describe `minicore` test auxiliary and directive (rust-lang/rustc-dev-guide#2097) - Fix and update docs for `needs-force-clang-based-tests` (rust-lang/rustc-dev-guide#2085) - Add redirects for integration-testing and headers (rust-lang/rustc-dev-guide#2092) - Fix borked links (rust-lang/rustc-dev-guide#2119) - Describe how to revert a PR (rust-lang/rustc-dev-guide#2118) - Linkify the footnotes in the async closure chapter (rust-lang/rustc-dev-guide#2117) - Try to fix footnotes (rust-lang/rustc-dev-guide#2115) - Fix rustc-related links that are 404 right now (rust-lang/rustc-dev-guide#2112) - Async closures chapter (rust-lang/rustc-dev-guide#2110) - update rfl ci job policy (rust-lang/rustc-dev-guide#2108) - Fix internal and incomplete links (rust-lang/rustc-dev-guide#2107) - Describe why and how to use a separate build directory for rust-analyzer (rust-lang/rustc-dev-guide#2106) - Update current status of diagnostics translation infra (rust-lang/rustc-dev-guide#2105) - update const stability docs (rust-lang/rustc-dev-guide#2098) - Advice on auto-formatting C++ code (rust-lang/rustc-dev-guide#2104) - Update compiler-src.md (rust-lang/rustc-dev-guide#2102)
Rollup merge of rust-lang#132601 - rustbot:docs-update, r=ehuss Update books ## rust-lang/edition-guide 3 commits in 1f07c242f8162a711a5ac5a4ea8fa7ec884ee7a9..2d482e203eb6d6e353814cf1415c5f94e590b9e0 2024-11-04 14:42:36 UTC to 2019-06-14 21:27:05 UTC - 2024: rustfmt style edition (rust-lang/edition-guide#331) - rustdoc: Fix doctest `include` paths (rust-lang/edition-guide#329) - docs(cargo): Cover MSRV-aware resolver (rust-lang/edition-guide#328) ## rust-lang/reference 3 commits in 23ce619966541bf2c80d45fdfeecf3393e360a13..da0f6dad767670da0e8cd5af8a7090db3272f626 2024-11-01 12:52:51 UTC to 2024-10-30 13:30:17 UTC - fix typo referring to 'Unsize' trait (rust-lang/reference#1669) - Add identifier syntax to items.md and subchapters (rust-lang/reference#1599) - Rename "object safe" to "dyn compatible" (rust-lang/reference#1666) ## rust-lang/rust-by-example 5 commits in 8bede1b919a81ab7d0c961f6bbf68d3efa297bd2..9db78608b17d5f4a6c033b8a3038466b87d63206 2024-10-31 21:03:20 UTC to 2024-10-26 16:06:05 UTC - fix(doc): correct small errors in pipes.md (rust-lang/rust-by-example#1894) - Fix ambiguous comment on 2.3 Arrays and Slices page (rust-lang/rust-by-example#1885) - Fix typo in generics/new_types (rust-lang/rust-by-example#1892) - docs(zh): fix known issues (rust-lang/rust-by-example#1891) - `read_lines`: Use `.map_while(Result::ok)` instead of `.flatten()`. (rust-lang/rust-by-example#1890) ## rust-lang/rustc-dev-guide 22 commits in 59d94ea..6a5accd 2024-11-04 14:40:57 UTC to 2024-10-24 20:33:08 UTC - Add a link for the `reference` compiletest header (rust-lang/rustc-dev-guide#2096) - Slightly fix up the glossary (rust-lang/rustc-dev-guide#2127) - Remove an mdbook workaround (rust-lang/rustc-dev-guide#2124) - Fix broken links (rust-lang/rustc-dev-guide#2123) - Fix minicore.rs link (rust-lang/rustc-dev-guide#2122) - Update for recent dataflow simplifications. (rust-lang/rustc-dev-guide#2121) - Describe `minicore` test auxiliary and directive (rust-lang/rustc-dev-guide#2097) - Fix and update docs for `needs-force-clang-based-tests` (rust-lang/rustc-dev-guide#2085) - Add redirects for integration-testing and headers (rust-lang/rustc-dev-guide#2092) - Fix borked links (rust-lang/rustc-dev-guide#2119) - Describe how to revert a PR (rust-lang/rustc-dev-guide#2118) - Linkify the footnotes in the async closure chapter (rust-lang/rustc-dev-guide#2117) - Try to fix footnotes (rust-lang/rustc-dev-guide#2115) - Fix rustc-related links that are 404 right now (rust-lang/rustc-dev-guide#2112) - Async closures chapter (rust-lang/rustc-dev-guide#2110) - update rfl ci job policy (rust-lang/rustc-dev-guide#2108) - Fix internal and incomplete links (rust-lang/rustc-dev-guide#2107) - Describe why and how to use a separate build directory for rust-analyzer (rust-lang/rustc-dev-guide#2106) - Update current status of diagnostics translation infra (rust-lang/rustc-dev-guide#2105) - update const stability docs (rust-lang/rustc-dev-guide#2098) - Advice on auto-formatting C++ code (rust-lang/rustc-dev-guide#2104) - Update compiler-src.md (rust-lang/rustc-dev-guide#2102)
rust-lang/rust#123799
rendered