Skip to content

Commit 5b18111

Browse files
Laziness
1 parent 969960f commit 5b18111

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

CONTRIBUTING.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ This mostly applies to your new module, each import from it, and to your new `It
2929
- Mutably borrow when it consumes only part of the iterator, such as `find`, `all`, `try_collect`...
3030
- Immutably borrow when there is no change, such as `size_hint`.
3131

32+
### Laziness
33+
Iterators are [lazy](https://doc.rust-lang.org/std/iter/index.html#laziness):
34+
35+
- structs of iterator adaptors should have `#[must_use = "iterator adaptors are lazy and do nothing unless consumed"]` ;
36+
- structs of iterators should have `#[must_use = "iterators are lazy and do nothing unless consumed"]`.
37+
3238
## Specialize `Iterator` methods
3339
It might be more performant to specialize some methods.
3440
However, each specialization should be thoroughly tested.

0 commit comments

Comments
 (0)