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

Format tests with rustfmt (276-287 of 299) #2254

Merged
merged 3 commits into from
Jun 22, 2022

Conversation

dtolnay
Copy link
Member

@dtolnay dtolnay commented Jun 22, 2022

Extracted from #2097.

This is one half of the last 24 files (left for last because they require more unique attention than the first 275 "easy" files).

I'll comment below to call attention to cases where I exercised my own judgement in how to format the test.

rust-lang/rustfmt#3255 is especially annoying: rustfmt does not like …( // and …{ //.

Comment on lines 21 to 23
let j1 = spawn(move || {
*ptr.0
let _val = *ptr.0;
});
Copy link
Member Author

Choose a reason for hiding this comment

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

This is a behavior change, but I did this to preserve the way both spawn use a multiline block. This is similar to #2244 (comment). With the behavior change it still correctly tests what the test was intended to cover.

Comment on lines -4 to +5
let _fat: [u8; (1<<61)+(1<<31)] =
[0; (1u64<<61) as usize +(1u64<<31) as usize]; //~ ERROR post-monomorphization error
let _fat: [u8; (1 << 61) + (1 << 31)];
_fat = [0; (1u64 << 61) as usize + (1u64 << 31) as usize]; //~ ERROR post-monomorphization error
Copy link
Member Author

Choose a reason for hiding this comment

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

Rustfmt wanted to do one line for all this. I split into 2 statements to preserve the specificity of the test in checking that the error is triggered on the rhs, not on the binding's pattern or type.

libc::FUTEX_WAKE,
10, // Wake up at most 10 threads.
),
1, // Woken up one thread.
Copy link
Member Author

Choose a reason for hiding this comment

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

It was clear to me that this comment refers to the 1, not the assert as a whole.

Comment on lines +68 to 70
#[rustfmt::skip] // https://github.com/rust-lang/rustfmt/issues/3255
for &size in &[2, 8, 64] { // size less than and bigger than alignment
for &align in &[4, 8, 16, 32] { // Be sure to cover less than and bigger than `MIN_ALIGN` for all architectures
Copy link
Member Author

Choose a reason for hiding this comment

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

@@ -61,7 +92,7 @@ fn check_align_requests<T: Allocator>(allocator: T) {
}
}
}
}
};
Copy link
Member Author

Choose a reason for hiding this comment

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

Without this semicolon,—

error[E0658]: attributes on expressions are experimental
  --> tests/pass/heap_allocator.rs:68:5
   |
LL |     #[rustfmt::skip] // https://github.com/rust-lang/rustfmt/issues/3255
   |     ^^^^^^^^^^^^^^^^
   |
   = note: see issue #15701 <https://github.com/rust-lang/rust/issues/15701> for more information
   = help: add `#![feature(stmt_expr_attributes)]` to the crate attributes to enable

Comment on lines -2 to +3
for _ in Vec::<u32>::new().iter() { // this iterates over a Unique::empty()
// Iterate over a Unique::empty()
for _ in Vec::<u32>::new().iter() {
Copy link
Member Author

Choose a reason for hiding this comment

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

Reworded for consistency with the comment on the other for loop after this one.

@oli-obk
Copy link
Contributor

oli-obk commented Jun 22, 2022

@bors r+

@bors
Copy link
Contributor

bors commented Jun 22, 2022

📌 Commit 05893d9 has been approved by oli-obk

@bors
Copy link
Contributor

bors commented Jun 22, 2022

⌛ Testing commit 05893d9 with merge 769c6c7...

@bors
Copy link
Contributor

bors commented Jun 22, 2022

☀️ Test successful - checks-actions
Approved by: oli-obk
Pushing 769c6c7 to master...

@bors bors merged commit 769c6c7 into rust-lang:master Jun 22, 2022
bors added a commit that referenced this pull request Jun 22, 2022
Format tests with rustfmt (288-299 of 299)

Extracted from #2097.

I'll make a separate PR to enable checking the `tests` directory's formatting in CI. I'll need to rebase that after both this and #2254 have landed, and if any new non-rustfmt-formatted files appear in the meantime, we can include formatting those in the same PR that enables the CI.
@dtolnay dtolnay deleted the rustfmt6 branch June 22, 2022 11:50
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.

3 participants