Skip to content

Commit 72d2ee9

Browse files
authored
fix(fmt): avoid blank line before identifiers (#11908)
1 parent 6e91f79 commit 72d2ee9

File tree

5 files changed

+25
-1
lines changed

5 files changed

+25
-1
lines changed

crates/fmt/src/state/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ impl State<'_, '_> {
360360
}
361361

362362
fn print_ident(&mut self, ident: &ast::Ident) {
363-
if self.handle_span(ident.span, false) {
363+
if self.handle_span(ident.span, true) {
364364
return;
365365
}
366366

crates/fmt/testdata/Repros/fmt.sol

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,11 @@ function argListRepro(address tokenIn, uint256 amountIn, bool data) {
177177
);
178178
}
179179

180+
// https://github.com/foundry-rs/foundry/issues/11905
181+
function noBlanksLinesBeforeIdentifiers() public {
182+
timelockController.grantRole(keccak256("EXECUTOR_ROLE"), address(0));
183+
}
184+
180185
contract NestedCallsTest is Test {
181186
string constant errMsg = "User provided message";
182187
uint256 constant maxDecimals = 77;

crates/fmt/testdata/Repros/original.sol

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,15 @@ function argListRepro(address tokenIn, uint256 amountIn, bool data) {
178178
);
179179
}
180180

181+
// https://github.com/foundry-rs/foundry/issues/11905
182+
function noBlanksLinesBeforeIdentifiers() public {
183+
timelockController
184+
185+
186+
187+
.grantRole(keccak256("EXECUTOR_ROLE"), address(0));
188+
}
189+
181190
contract NestedCallsTest is Test {
182191
string constant errMsg = "User provided message";
183192
uint256 constant maxDecimals = 77;

crates/fmt/testdata/Repros/sorted.fmt.sol

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,11 @@ function argListRepro(address tokenIn, uint256 amountIn, bool data) {
178178
);
179179
}
180180

181+
// https://github.com/foundry-rs/foundry/issues/11905
182+
function noBlanksLinesBeforeIdentifiers() public {
183+
timelockController.grantRole(keccak256("EXECUTOR_ROLE"), address(0));
184+
}
185+
181186
contract NestedCallsTest is Test {
182187
string constant errMsg = "User provided message";
183188
uint256 constant maxDecimals = 77;

crates/fmt/testdata/Repros/tab.fmt.sol

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,11 @@ function argListRepro(address tokenIn, uint256 amountIn, bool data) {
178178
);
179179
}
180180

181+
// https://github.com/foundry-rs/foundry/issues/11905
182+
function noBlanksLinesBeforeIdentifiers() public {
183+
timelockController.grantRole(keccak256("EXECUTOR_ROLE"), address(0));
184+
}
185+
181186
contract NestedCallsTest is Test {
182187
string constant errMsg = "User provided message";
183188
uint256 constant maxDecimals = 77;

0 commit comments

Comments
 (0)