Skip to content
This repository was archived by the owner on Oct 9, 2018. It is now read-only.

Commit 22993c4

Browse files
committed
Reference RFC 199 for ownership variants, mention into_iter
1 parent 53984f9 commit 22993c4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

style/naming/ownership.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
% Ownership variants
1+
% Ownership variants [RFC #199]
2+
3+
> The guidelines below were approved by [RFC #199](https://github.com/rust-lang/rfcs/pull/199).
24
35
Functions often come in multiple variants: immutably borrowed, mutably
46
borrowed, and owned.
@@ -22,6 +24,11 @@ If `foo` uses/produces owned data by default, use:
2224

2325
#### Exceptions
2426

27+
In the case of iterators, the moving variant can also be understood as
28+
an `into` conversion, `into_iter`, and `for x in v.into_iter()` reads
29+
arguably better than `for x in v.iter_move()`, so the convention is
30+
`into_iter`.
31+
2532
For mutably borrowed variants, if the `mut` qualifier is part of a
2633
type name (e.g. `as_mut_slice`), it should appear as it would appear
2734
in the type.

0 commit comments

Comments
 (0)