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

rustfmt use declarations #125443

Merged
merged 2 commits into from
Jul 29, 2024
Merged

rustfmt use declarations #125443

merged 2 commits into from
Jul 29, 2024

Conversation

nnethercote
Copy link
Contributor

@nnethercote nnethercote commented May 23, 2024

This PR implements rust-lang/compiler-team#750, which changes how use declarations are formatted by adding these options to rustfmt.toml:

group_imports = "StdExternalCrate"
imports_granularity = "Module"

r? @ghost

@rustbot rustbot added A-meta Area: Issues about the rust-lang/rust repository. A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-rustdoc-json Area: Rustdoc JSON backend A-testsuite Area: The testsuite used to check the correctness of rustc A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic O-android Operating system: Android O-hermit Operating System: Hermit O-ios Operating system: iOS O-itron Operating System: ITRON O-linux Operating system: Linux O-macos Operating system: macOS O-netbsd Operating system: NetBSD O-redox Operating system: Redox, https://www.redox-os.org/ O-SGX Target: SGX O-solaris Operating system: Solaris O-solid Operating System: SOLID O-unix Operating system: Unix-like O-visionos Apple visionOS O-wasi Operating system: Wasi, Webassembly System Interface O-wasm Target: WASM (WebAssembly), http://webassembly.org/ O-watchos Operating System: watchOS O-windows Operating system: Windows PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative labels May 23, 2024
@rust-timer
Copy link
Collaborator

Finished benchmarking commit (2e63026): comparison URL.

Overall result: ❌ regressions - no action needed

@rustbot label: -perf-regression

Instruction count

This is a highly reliable metric that was used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
0.5% [0.5%, 0.5%] 1
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
- - 0
All ❌✅ (primary) 0.5% [0.5%, 0.5%] 1

Max RSS (memory usage)

This benchmark run did not return any relevant results for this metric.

Cycles

Results (secondary -3.8%)

This is a less reliable metric that may be of interest but was not used to determine the overall result at the top of this comment.

mean range count
Regressions ❌
(primary)
- - 0
Regressions ❌
(secondary)
- - 0
Improvements ✅
(primary)
- - 0
Improvements ✅
(secondary)
-3.8% [-3.8%, -3.8%] 1
All ❌✅ (primary) - - 0

Binary size

This benchmark run did not return any relevant results for this metric.

Bootstrap: 767.825s -> 769.325s (0.20%)
Artifact size: 331.40 MiB -> 331.39 MiB (-0.00%)

@kornelski
Copy link
Contributor

This has created a ton of merge conflicts, and most annoyingly it has undone #127090 which deliberately avoided rustfmt's brute naïveté to allow more than one options PR to coexist.

@nnethercote
Copy link
Contributor Author

You can use #[rustfmt::skip] if you need it. I recommend adding explanatory comments alongside.

nnethercote added a commit to nnethercote/rust that referenced this pull request Jul 29, 2024
In rust-lang#125443 this comment ended up in the wrong spot. I'm not sure why;
after careful checking this was the only case I could find like this.
@nnethercote nnethercote mentioned this pull request Jul 29, 2024
@tgross35
Copy link
Contributor

This isn't especially noisy, but a .git-blame-ignore-revs entry might still be worth doing.

@nnethercote
Copy link
Contributor Author

This isn't especially noisy, but a .git-blame-ignore-revs entry might still be worth doing.

Done in #128478.

matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 1, 2024
…e-revs, r=jieyouxu

Ignore `use` declaration reformatting in `.git-blame-ignore-revs`.

The reformatting was done in rust-lang#125443.

r? `@lcnr`
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Aug 1, 2024
Rollup merge of rust-lang#128478 - nnethercote:update-git-blame-ignore-revs, r=jieyouxu

Ignore `use` declaration reformatting in `.git-blame-ignore-revs`.

The reformatting was done in rust-lang#125443.

r? `@lcnr`
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Aug 3, 2024
Formatting tweaks

Some small post-rust-lang#125443 formatting tweaks.

r? `@cuviper`
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Aug 3, 2024
Formatting tweaks

Some small post-rust-lang#125443 formatting tweaks.

r? ``@cuviper``
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Aug 3, 2024
Rollup merge of rust-lang#128368 - nnethercote:rustfmt-tweaks, r=cuviper

Formatting tweaks

Some small post-rust-lang#125443 formatting tweaks.

r? ``@cuviper``
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-meta Area: Issues about the rust-lang/rust repository. A-query-system Area: The rustc query system (https://rustc-dev-guide.rust-lang.org/query.html) A-run-make Area: port run-make Makefiles to rmake.rs A-rustdoc-json Area: Rustdoc JSON backend A-testsuite Area: The testsuite used to check the correctness of rustc A-translation Area: Translation infrastructure, and migrating existing diagnostics to SessionDiagnostic merged-by-bors This PR was explicitly merged by bors. O-android Operating system: Android O-apple Operating system: Apple (macOS, iOS, tvOS, visionOS, watchOS) O-hermit Operating System: Hermit O-ios Operating system: iOS O-itron Operating System: ITRON O-linux Operating system: Linux O-macos Operating system: macOS O-netbsd Operating system: NetBSD O-redox Operating system: Redox, https://www.redox-os.org/ O-SGX Target: SGX O-solaris Operating system: Solaris O-solid Operating System: SOLID O-unix Operating system: Unix-like O-visionos Apple visionOS O-wasi Operating system: Wasi, Webassembly System Interface O-wasm Target: WASM (WebAssembly), http://webassembly.org/ O-watchos Operating System: watchOS O-windows Operating system: Windows PG-exploit-mitigations Project group: Exploit mitigations S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. T-infra Relevant to the infrastructure team, which will review and decide on the PR/issue. T-libs Relevant to the library team, which will review and decide on the PR/issue. T-rustdoc Relevant to the rustdoc team, which will review and decide on the PR/issue. WG-trait-system-refactor The Rustc Trait System Refactor Initiative
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.