Skip to content

Add copy_iterator lint (#1534) #2924

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
Aug 24, 2018
Merged

Conversation

niklasf
Copy link
Contributor

@niklasf niklasf commented Jul 17, 2018

This is the easier part of #1534, i.e. detecting when Copy and Iterator are implemented on the same type.

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

Thanks for implementing this! Sorry for the long wait time until this review. This completely slipped through..

Just a small NIT, everything else LGTM. (Probably needs a rebase)

let ty = cx.tcx.type_of(cx.tcx.hir.local_def_id(item.id));

if is_copy(cx, ty) && match_path(&trait_ref.path, &paths::ITERATOR) {
span_lint_and_then(
Copy link
Member

Choose a reason for hiding this comment

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

You can use the utils::span_note_and_lint function here.

@niklasf
Copy link
Contributor Author

niklasf commented Aug 24, 2018

Thanks. Rebased + using span_note_and_lint now.

Copy link
Member

@flip1995 flip1995 left a comment

Choose a reason for hiding this comment

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

Thanks! Waiting for the new nightly and CI pass.

@flip1995
Copy link
Member

Oh nvm. Already passed 😄

@flip1995 flip1995 merged commit 72344f4 into rust-lang:master Aug 24, 2018
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.

2 participants