diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2014-07-09 22:13:14 +1000 |
|---|---|---|
| committer | Huon Wilson <dbau.pp+github@gmail.com> | 2014-07-10 08:05:58 +1000 |
| commit | 27d18fbe41665eef798eb29660c1883bb8600502 (patch) | |
| tree | 221e976d9ef86765d176d3b37c8c1740adfb66a6 /src/rustllvm/ExecutionEngineWrapper.cpp | |
| parent | b9e35a164416272a3aa3778c2ce9669dcc15c556 (diff) | |
| download | rust-27d18fbe41665eef798eb29660c1883bb8600502.tar.gz rust-27d18fbe41665eef798eb29660c1883bb8600502.zip | |
core: add `#[must_use]` attributes to iterator adaptor structs.
It can be a little unintuitive that something like `v.iter().map(|x|
println!("{}", x));` does nothing: the majority of the iterator adaptors
are lazy and do not execute anything until something calls `next`, e.g.
a `for` loop, `collect`, `fold`, etc.
The majority of such errors can be seen by someone writing something
like the above, i.e. just calling an iterator adaptor and doing nothing
with it (and doing this is certainly useless), so we can co-opt the
`must_use` lint, using the message functionality to give a hint to the
reason why.
Fixes #14666.
Diffstat (limited to 'src/rustllvm/ExecutionEngineWrapper.cpp')
0 files changed, 0 insertions, 0 deletions
