Skip to content

Use suggestion for needless_return #494

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

Merged
merged 1 commit into from
Dec 17, 2015
Merged

Use suggestion for needless_return #494

merged 1 commit into from
Dec 17, 2015

Conversation

sanxiyn
Copy link
Member

@sanxiyn sanxiyn commented Dec 11, 2015

cc #442.

Instead of saying "without trailing semicolon", show the replacement without trailing semicolon.

"unneeded return statement. Consider using `{}` \
without the return and trailing semicolon",
snippet(cx, spans.1, "..")))
span_lint_and_then(cx, NEEDLESS_RETURN, spans.0,
Copy link
Contributor

Choose a reason for hiding this comment

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

What if the snippet is None?

Copy link
Member Author

Choose a reason for hiding this comment

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

Previously, we said "Consider using ..", which is nonsense. Now we say "unneeded return statement", without a suggestion.

Copy link
Contributor

Choose a reason for hiding this comment

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

Fine, but we could do even better by defaulting to a suggestion to remove the return and semicolon.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, maybe later.

I note that currently we say "without trailing semicolon" even when there is no trailing semicolon. I don't think the current message is very good.

Manishearth added a commit that referenced this pull request Dec 17, 2015
Use suggestion for needless_return
@Manishearth Manishearth merged commit b900e88 into rust-lang:master Dec 17, 2015
@sanxiyn sanxiyn deleted the suggestion-2 branch December 18, 2015 04:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants