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

Remove blank lines when needless_return returns no value #9967

Merged
merged 2 commits into from
Nov 27, 2022

Conversation

koka831
Copy link
Contributor

@koka831 koka831 commented Nov 27, 2022

fix #9416

changelog: [needless_return] improve result format

r? @llogiq

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Nov 27, 2022
let ws = [' ', '\t', '\n'];
if let Some(non_ws_pos) = prev_source.rfind(|c| !ws.contains(&c)) {
let len = prev_source.len() - non_ws_pos - 1;
return sp.with_lo(BytePos(sp.lo().0 - len as u32));
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return sp.with_lo(BytePos(sp.lo().0 - len as u32));
return sp.with_lo(sp.lo() - BytePos::from_usize(len));

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for your quick response.
I resolved it in 39d0477.

@llogiq
Copy link
Contributor

llogiq commented Nov 27, 2022

Just a small nit re BytePos handling, otherwise I'm happy to have bors merging this.

@llogiq
Copy link
Contributor

llogiq commented Nov 27, 2022

Thank you!

@bors r+

@bors
Copy link
Collaborator

bors commented Nov 27, 2022

📌 Commit 39d0477 has been approved by llogiq

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Nov 27, 2022

⌛ Testing commit 39d0477 with merge c8eba8e...

@bors
Copy link
Collaborator

bors commented Nov 27, 2022

☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test
Approved by: llogiq
Pushing c8eba8e to master...

@bors bors merged commit c8eba8e into rust-lang:master Nov 27, 2022
@koka831 koka831 deleted the fix/9416 branch November 28, 2022 00:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fix for needless_return replaces no-value returns with blank lines
4 participants