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

Fix single_match suggestions with expanded macros #3272

Open
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
2 participants
@phansch
Collaborator

phansch commented Oct 6, 2018

single_match was expanding macros in the suggested if and else expressions. This fix checks if the suggested span is inside a macro.

As far as I can tell this..

Fixes #1148
Fixes #2455

let els_str = els.map_or(String::new(), |els| format!(" else {}", expr_block(cx, els, None, "..")));
let els_str = els.map_or(String::new(), |els| {
if in_macro(els.span) {
" else { .. }".to_string()

This comment has been minimized.

@flip1995

flip1995 Oct 15, 2018

Collaborator

Could we maybe get a better suggestion with source_callsite()

Everything else LGTM.

@flip1995

flip1995 Oct 15, 2018

Collaborator

Could we maybe get a better suggestion with source_callsite()

Everything else LGTM.

This comment has been minimized.

@phansch

phansch Oct 16, 2018

Collaborator

I will give it a try, thanks!

@phansch

phansch Oct 16, 2018

Collaborator

I will give it a try, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment