Skip to content
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

Added lint for unnecessary references. #2808

Merged
merged 1 commit into from
May 28, 2018
Merged

Conversation

XAMPPRocky
Copy link
Member

@XAMPPRocky XAMPPRocky commented May 28, 2018

I'm unsure if the way I did the suggestion is the most correct or idiomatic. 😅
fixes #2642

if let ExprKind::Paren(ref parened) = object.node;
if let ExprKind::AddrOf(_, ref inner) = parened.node;
then {
let corrected = snippet(cx, e.span, "_")
Copy link
Contributor

Choose a reason for hiding this comment

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

xD yea that looks too fragile.

You can get the snippets of both inner.span and field_name.span and then use format! to generate a new field access

@XAMPPRocky
Copy link
Member Author

@oli-obk Updated with suggestions. Let me know if there's anything else wrong with the code!

@oli-obk oli-obk merged commit 0d1e06d into rust-lang:master May 28, 2018
@oli-obk
Copy link
Contributor

oli-obk commented May 28, 2018

perfect! thanks

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.

lint (&foo).bar
2 participants