Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions rustfmt-core/rustfmt-lib/tests/source/issue-3550.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
fn main() {
assert(long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long(),
);

assert!(long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long(),);
}

14 changes: 14 additions & 0 deletions rustfmt-core/rustfmt-lib/tests/target/issue-3068.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
// rustfmt-hard_tabs: true
// rustfmt-single_line_if_else_max_width: 10

macro_rules! foo {
($bar: expr, $t: ty) => {
$bar(|x| {
if x {
None
} else {
None
}
})
};
}
39 changes: 39 additions & 0 deletions rustfmt-core/rustfmt-lib/tests/target/issue-3550.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
fn main() {
assert(
long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long(),
);

assert!(
long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long()
.long(),
);
Copy link
Member

Choose a reason for hiding this comment

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

What's this second one validating that's not covered by the first one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The first is a function, the second is the assert! macro. Per #3550 we want to see that assert! is formatted similar to regular function calls.

Copy link
Member

Choose a reason for hiding this comment

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

ha! and that's why reviewing PRs when half asleep isn't a great idea 😄

}
19 changes: 19 additions & 0 deletions rustfmt-core/rustfmt-lib/tests/target/issue-3638.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
macro_rules! abait {
($x:expr) => {
Ok(())
};
}

mod a {
fn foo() -> Result<(), ()> {
unsafe {
(
abait!(
proxy.load_account(ahc_client_end, TEST_ACCOUNT_ID.clone().as_mut().into())
)?,
(),
)
};
Ok(())
}
}
12 changes: 12 additions & 0 deletions rustfmt-core/rustfmt-lib/tests/target/issue-3858.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// rustfmt-hard_tabs: true

macro_rules! member_mut {
($self:expr, $member:expr) => {{
use self::Member::*;
let r = &mut *$self;
match $member {
A => &mut r.a,
B => &mut r.b,
}
}};
}
9 changes: 9 additions & 0 deletions rustfmt-core/rustfmt-lib/tests/target/issue-3936.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// rustfmt-hard_tabs: true

macro_rules! m {
($a:expr) => {
if $a {
return;
}
};
}