-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
Add explicit return statement for readability #432
Conversation
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.
Nice! thanks so much. CONTRIBUTING didn't convince you to use emoji prefixes? ;)
No functional changes because everything else is behind other #cfg macros so this is our only effective block here. But those others use return so it makes the code more consistent.
oops. Also turns out that clippy was unhappy because it's a needless return so I had to add the |
Hmm.. in that case, I'd disagree with |
Yeah, fair enough. Feel free to close this PR though as I said above, I'm pretty sure clippy will fail on macos right now too. |
Just to be clear, you mean with this PR, right? It currently seems to work fine on |
Hah, indeed, this appears to be a bug in clippy which doesn't warn about single-line returns but it does in a block. i.e. // this code does not trigger a warning
#[cfg(target_os = "macos")]
return Self::from_str("launchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET"); // warning: unneeded `return` statement
#[cfg(target_os = "macos")]
{
return Self::from_str("launchd:env=DBUS_LAUNCHD_SESSION_BUS_SOCKET");
} Purely from looking at the code I would've expected either to trigger a warning. (also thanks, now I learned about |
@whot so we can close this then? Please close it, if you agree. |
yep, let's close this |
A typo fix and an explicit
return
to match the surrounding code