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

coverage: Format all coverage tests with rustfmt #120015

Merged
merged 3 commits into from
Jan 21, 2024
Merged

Conversation

Zalathar
Copy link
Contributor

As suggested by #119984 (comment).

Test files in tests/ are normally ignored by x fmt, but sometimes those files end up being run through rustfmt anyway, either by rust-analyzer or by hand.

When that happens, it's annoying to have to manually revert formatting changes that are unrelated to the actual changes being made. So it's helpful for the tests in the repository to already have standard formatting beforehand.

However, there are several coverage tests that deliberately use non-standard formatting, so that line counts reveal more information about where code regions begin and end. In those cases, we can use #[rustfmt::skip] to prevent that code from being disturbed.

@rustbot label +A-code-coverage

These tests deliberately use non-standard formatting, so that the line
execution counts reported by `llvm-cov` reveal additional information about
where code regions begin and end.
@rustbot
Copy link
Collaborator

rustbot commented Jan 16, 2024

r? @Mark-Simulacrum

(rustbot has picked a reviewer for you, use r? to override)

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) labels Jan 16, 2024
@Zalathar
Copy link
Contributor Author

Zalathar commented Jan 16, 2024

cc @dtolnay @kpreid

I have deliberately avoided touching closure_macro_async.rs so that this won't interfere with #119984, which also formats that file. There are some other files that are touched by both PRs, but those should hopefully merge cleanly.

(If there's any doubt, I'm happy to wait until after that PR has had a chance to land.)

Some of these tests use non-standard formatting that we can simulate by
strategically adding `//` line comments.

One contains `where` clauses that would be split across multiple lines, which
we can keep on one line by moving the bounds to the generic type instead.
Copy link
Member

@dtolnay dtolnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for following up on this!

@dtolnay
Copy link
Member

dtolnay commented Jan 16, 2024

@bors r+ delegate+

@bors
Copy link
Contributor

bors commented Jan 16, 2024

📌 Commit 5dcc359 has been approved by dtolnay

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 16, 2024
@bors
Copy link
Contributor

bors commented Jan 16, 2024

✌️ @Zalathar, you can now approve this pull request!

If @dtolnay told you to "r=me" after making some further change, please make that change, then do @bors r=@dtolnay

@dtolnay
Copy link
Member

dtolnay commented Jan 16, 2024

In case any other minor changes are needed to make this pass in CI, feel free to use r=dtolnay.

@kpreid
Copy link
Contributor

kpreid commented Jan 17, 2024

FYI, I have decided to remove the formatting change in closure_macro_async.rs from #119984, simply because it is so much a separate issue and not getting it right already blocked merge once.

These tests can simply be reformatted as normal, because the resulting changes
are unimportant.
@Zalathar
Copy link
Contributor Author

Zalathar commented Jan 17, 2024

The formatting changes to closure_macro_async.rs have been removed from #119984, so I've updated this PR to also format that file (diff).

@Zalathar
Copy link
Contributor Author

@bors r=dtolnay

@bors
Copy link
Contributor

bors commented Jan 18, 2024

📌 Commit 99797bb has been approved by dtolnay

It is now in the queue for this repository.

GuillaumeGomez added a commit to GuillaumeGomez/rust that referenced this pull request Jan 20, 2024
coverage: Format all coverage tests with `rustfmt`

As suggested by <rust-lang#119984 (comment)>.

Test files in `tests/` are normally ignored by `x fmt`, but sometimes those files end up being run through `rustfmt` anyway, either by `rust-analyzer` or by hand.

When that happens, it's annoying to have to manually revert formatting changes that are unrelated to the actual changes being made. So it's helpful for the tests in the repository to already have standard formatting beforehand.

However, there are several coverage tests that deliberately use non-standard formatting, so that line counts reveal more information about where code regions begin and end. In those cases, we can use `#[rustfmt::skip]` to prevent that code from being disturbed.

`@rustbot` label +A-code-coverage
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 20, 2024
…llaumeGomez

Rollup of 6 pull requests

Successful merges:

 - rust-lang#118257 (Make traits / trait methods detected by the dead code lint)
 - rust-lang#119997 (Fix impl stripped in rustdoc HTML whereas it should not be in case the impl is implemented on a type alias)
 - rust-lang#120000 (Ensure `callee_id`s are body owners)
 - rust-lang#120015 (coverage: Format all coverage tests with `rustfmt`)
 - rust-lang#120063 (Remove special handling of `box` expressions from parser)
 - rust-lang#120138 (Increase vscode settings.json `git.detectSubmodulesLimit`)

r? `@ghost`
`@rustbot` modify labels: rollup
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 21, 2024
Rollup of 8 pull requests

Successful merges:

 - rust-lang#116090 (Implement strict integer operations that panic on overflow)
 - rust-lang#118811 (Use `bool` instead of `PartiolOrd` as return value of the comparison closure in `{slice,Iteraotr}::is_sorted_by`)
 - rust-lang#119081 (Add Ipv6Addr::is_ipv4_mapped)
 - rust-lang#119461 (Use an interpreter in MIR jump threading)
 - rust-lang#119996 (Move OS String implementation into `sys`)
 - rust-lang#120015 (coverage: Format all coverage tests with `rustfmt`)
 - rust-lang#120027 (pattern_analysis: Remove `Ty: Copy` bound)
 - rust-lang#120084 (fix(rust-analyzer): use new pkgid spec to compare)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit e8678b1 into rust-lang:master Jan 21, 2024
11 checks passed
@rustbot rustbot added this to the 1.77.0 milestone Jan 21, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 21, 2024
Rollup merge of rust-lang#120015 - Zalathar:format, r=dtolnay

coverage: Format all coverage tests with `rustfmt`

As suggested by <rust-lang#119984 (comment)>.

Test files in `tests/` are normally ignored by `x fmt`, but sometimes those files end up being run through `rustfmt` anyway, either by `rust-analyzer` or by hand.

When that happens, it's annoying to have to manually revert formatting changes that are unrelated to the actual changes being made. So it's helpful for the tests in the repository to already have standard formatting beforehand.

However, there are several coverage tests that deliberately use non-standard formatting, so that line counts reveal more information about where code regions begin and end. In those cases, we can use `#[rustfmt::skip]` to prevent that code from being disturbed.

``@rustbot`` label +A-code-coverage
@Zalathar Zalathar deleted the format branch January 21, 2024 11:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-code-coverage Area: Source-based code coverage (-Cinstrument-coverage) S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants