-
Notifications
You must be signed in to change notification settings - Fork 13.3k
Suggest removing semicolon at the end of non-unit function #21838
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
Comments
Removing the semicolon would cause a type error, therefore the compiler is correct not printing the help message. EDIT: pointing out which branches don’t return a value might be useful though. |
It's two errors at once. |
Another option: only suggest removing the semicolon if the expression before the semicolon matches the return type of the function. |
Ah nevermind then |
I got bit today by a more complex example:
which happened because I accidentally a semicolon after a pretty big |
Triage: no change, other than the new error format. |
Closing in favor of collective issue for this general problem: #41897. |
With this code, rustc doesn't print a message such as:
It only prints
The text was updated successfully, but these errors were encountered: