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

Add copy_iterator lint (#1534) #2924

Merged
merged 1 commit into from Aug 24, 2018
Merged

Add copy_iterator lint (#1534) #2924

merged 1 commit into from Aug 24, 2018

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

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(

This comment has been minimized.

@flip1995

flip1995 Aug 24, 2018
Member

You can use the utils::span_note_and_lint function here.

@niklasf niklasf force-pushed the niklasf:copy-iterator branch from c32ba5e to afdf350 Aug 24, 2018
@niklasf
Copy link
Contributor Author

@niklasf niklasf commented Aug 24, 2018

Thanks. Rebased + using span_note_and_lint now.

Copy link
Member

@flip1995 flip1995 left a comment

Thanks! Waiting for the new nightly and CI pass.

@flip1995
Copy link
Member

@flip1995 flip1995 commented Aug 24, 2018

Oh nvm. Already passed 😄

@flip1995 flip1995 merged commit 72344f4 into rust-lang:master Aug 24, 2018
2 checks passed
2 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants