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

iter conservation efforts: save the endangered .iter() and .into_iter() #3119

Conversation

joshtriplett
Copy link
Member

 ______________________________________
/ It looks like you're writing a loop. \
\ Would you like some help?            /
 --------------------------------------
 \
  \
     __
    /  \
    |  |
    @  @
    |  |
    || |/
    || ||
    |\_/|
    \___/

Every day, more iters are lost, discarded as unwanted, to such hazards
as "concision" and "brevity". Won't someone think of the poor .iter()
and .into_iter(), that future generations may continue to admire them
and their self-documenting properties in their many and varied natural
habitats, and not merely in a zoo of (en)closures?

Make explicit_iter_loop and explicit_into_iter_loop allow-by-default, so
that people can turn them on if they want to enforce that style; avoid
presenting them as the idiomatic Rust style, rather than just a style.

@flip1995
Copy link
Member

flip1995 commented Sep 3, 2018

Also needs to be updated in clippy_lints/src/lib.rs. Running utils/update_lints.py should do this.

@joshtriplett joshtriplett force-pushed the a-message-from-the-save-the-iters-foundation branch from a5d296a to 8f30cb2 Compare September 3, 2018 07:50
@joshtriplett
Copy link
Member Author

@flip1995 Done, thanks.

@joshtriplett
Copy link
Member Author

More serious supporting information: many crates turn this off, including crates like cargo, and clap.

@flip1995
Copy link
Member

flip1995 commented Sep 3, 2018

Oh and the stderr file needs to be updated:

tests/ui/update-references.sh 'target/debug/test_build_base' 'for_loop.rs'

Make explicit_iter_loop and explicit_into_iter_loop allow-by-default, so
that people can turn them on if they want to enforce that style; avoid
presenting them as *the* idiomatic Rust style, rather than just *a* style.
@joshtriplett joshtriplett force-pushed the a-message-from-the-save-the-iters-foundation branch from 8f30cb2 to 7799883 Compare September 3, 2018 08:25
@joshtriplett
Copy link
Member Author

@flip1995 Done.

@joshtriplett
Copy link
Member Author

(The appveyor failure looks spurious.)

@flip1995
Copy link
Member

flip1995 commented Sep 3, 2018

Thanks!

Appveyor error is unrelated: #3118

@flip1995 flip1995 merged commit f5376a3 into rust-lang:master Sep 3, 2018
@Manishearth
Copy link
Member

@joshtriplett could you leave the requested comment on #3230 ? This is a minor PR so it doesn't really count, but might as well get the sign off if I can 😄

@joshtriplett
Copy link
Member Author

joshtriplett commented Oct 2, 2018 via email

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