diff options
| author | Brandon Waskiewicz <brandon.waskiewicz@gmail.com> | 2014-04-17 16:59:58 -0400 |
|---|---|---|
| committer | Brandon Waskiewicz <brandon.waskiewicz@gmail.com> | 2014-04-17 16:59:58 -0400 |
| commit | 58ae1e7c625491e9eceebdc9120ff009361106fa (patch) | |
| tree | 6e8e5748d802a1f971ec9dc04873ebbc124bd975 /src/doc/guide-pointers.md | |
| parent | ff0b0d5ceeb94fad1d043a5bd2eb631f1f47caff (diff) | |
| download | rust-58ae1e7c625491e9eceebdc9120ff009361106fa.tar.gz rust-58ae1e7c625491e9eceebdc9120ff009361106fa.zip | |
Remove rule that is confusing
The original text stated that one should only return a unique or managed pointer if you were given one in the first place. This makes it sound as if the function *should* return a unique pointer if it were given a unique pointer. The rest of the section goes on to describe why this is bad, and the example of bad code does exactly what the rule just said to do. I reworded the original rule into a reference to the more concise rule mentioned at the bottom of the section, which helps add emphasis (a la 'it bears repeating').
Diffstat (limited to 'src/doc/guide-pointers.md')
| -rw-r--r-- | src/doc/guide-pointers.md | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/doc/guide-pointers.md b/src/doc/guide-pointers.md index 5c6c562b72d..9780a12a402 100644 --- a/src/doc/guide-pointers.md +++ b/src/doc/guide-pointers.md @@ -430,8 +430,9 @@ great detail, so if you want the full details, check that out. # Returning Pointers We've talked a lot about functions that accept various kinds of pointers, but -what about returning them? Here's the rule of thumb: only return a unique or -managed pointer if you were given one in the first place. +what about returning them? In general, it is better to let the caller decide +how to use a function's output, instead of assuming a certain type of pointer +is best. What does that mean? Don't do this: |
