-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Conversation
clippy_lints/src/returns.rs
Outdated
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)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
return sp.with_lo(BytePos(sp.lo().0 - len as u32)); | |
return sp.with_lo(sp.lo() - BytePos::from_usize(len)); |
There was a problem hiding this comment.
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.
Just a small nit re BytePos handling, otherwise I'm happy to have bors merging this. |
Thank you! @bors r+ |
☀️ Test successful - checks-action_dev_test, checks-action_remark_test, checks-action_test |
fix #9416
changelog: [
needless_return
] improve result formatr? @llogiq