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

fix(fmt): doc block trailing whitespace #2600

Merged
merged 1 commit into from
Aug 4, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion fmt/src/formatter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ impl<'a, W: Write> Formatter<'a, W> {
writeln!(self.buf(), "/**")?;
for line in lines {
let line = line.trim().trim_start_matches('*').trim_start();
writeln!(self.buf(), " * {line}")?;
writeln!(self.buf(), "{}", format!(" * {line}").trim_end())?;
}
write!(self.buf(), " */")?;
} else {
Expand Down
8 changes: 7 additions & 1 deletion fmt/testdata/DocComments/fmt.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,13 @@ contract HelloWorld {
/**
* @dev does nothing
*/
function example() public {}
function example() public {
/**
* Does this add a whitespace error?
*
* Let's find out.
*/
}

/**
* @dev Calculates a rectangle's surface and perimeter.
Expand Down
8 changes: 7 additions & 1 deletion fmt/testdata/DocComments/original.sol
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,13 @@ contract HelloWorld {
}

/** @dev does nothing */
function example() public {}
function example() public {
/**
* Does this add a whitespace error?
*
* Let's find out.
*/
}

/** @dev Calculates a rectangle's surface and perimeter.
* @param w Width of the rectangle.
Expand Down