Skip to content

Format tests and benches with rustfmt (1-50 of 300) #2244

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

Merged
merged 4 commits into from
Jun 21, 2022

Conversation

dtolnay
Copy link
Member

@dtolnay dtolnay commented Jun 20, 2022

Extracted from #2097.

I filtered this PR to contain exclusively "easy" cases to start off with, i.e. where there is no compiletest_rs (or other) comment in the vicinity that might need to get manually repositioned.

@@ -13,9 +13,7 @@ pub fn main() {
let b = &mut a as *mut u32;
let c = EvilSend(b);
unsafe {
let j1 = spawn(move || {
*c.0
Copy link
Member

Choose a reason for hiding this comment

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

If we add a trailing ; here, does rustfmt keep the braces? I think I'd prefer that, for symmetry with the other spawn.

Copy link
Member Author

Choose a reason for hiding this comment

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

Rustc does not allow that.

error: unused unary operation that must be used
  --> tests/fail/data_race/read_write_race.rs:17
   |
17 |             *c.0;
   |             ^^^^ the unary operation produces a value
   |
   = note: `-D unused-must-use` implied by `-D unused`
help: use `let _ = ...` to ignore the resulting value
   |
17 |             let _ = *c.0;
   |             +++++++

And with let _ = *c.0;, miri does not detect the data race so the test fails.

I can use return *c.0;.

@RalfJung
Copy link
Member

Is it the case that this formats test-cargo-miri, bench-cargo-miri, benches completely? Can you add that part to CI already?

@dtolnay
Copy link
Member Author

dtolnay commented Jun 20, 2022

@RalfJung
Copy link
Member

RalfJung commented Jun 20, 2022 via email

@dtolnay
Copy link
Member Author

dtolnay commented Jun 20, 2022

Changed to let _val = place;.

@RalfJung
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jun 21, 2022

📌 Commit 53580c1 has been approved by RalfJung

@bors
Copy link
Contributor

bors commented Jun 21, 2022

⌛ Testing commit 53580c1 with merge 4d712a3...

@bors
Copy link
Contributor

bors commented Jun 21, 2022

☀️ Test successful - checks-actions
Approved by: RalfJung
Pushing 4d712a3 to master...

@bors bors merged commit 4d712a3 into rust-lang:master Jun 21, 2022
@dtolnay dtolnay deleted the rustfmt0 branch June 21, 2022 04:05
bors added a commit that referenced this pull request Jun 21, 2022
Format tests with rustfmt (101-150 of 300)

Extracted from #2097.

Like #2244, these are "easy" cases that do not involve moving around comments.
bors added a commit that referenced this pull request Jun 21, 2022
Format tests with rustfmt (51-100 of 300)

Extracted from #2097.

Like #2244, this is intended to be "easy" cases which don't involve comments in the vicinity.
github-actions bot pushed a commit that referenced this pull request Apr 21, 2025
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