Skip to content

change ~[] -> Vec for collect() - #14992

Merged
bors merged 1 commit into
rust-lang:masterfrom
nathantypanski:collect-docs
Jun 18, 2014
Merged

bors merged 1 commit into
rust-lang:masterfrom
nathantypanski:collect-docs

Conversation

@nathantypanski

Copy link
Copy Markdown
Contributor

This updates the documentation for result::collect() and
option::collect() to use the new-style syntax for owned pointers and
vectors.

closes #14991

@nathantypanski nathantypanski changed the title change ~[] -> Box<Vec> for collect() change ~[] -> Vec for collect() Jun 18, 2014
Comment thread src/libcore/option.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally prefer the closure form, rather than inc_conditionally taking a reference, since I think it's clearer what is happening.

@huonw

huonw commented Jun 18, 2014

Copy link
Copy Markdown
Contributor

Also, neither of these examples are being tested automatically; I guess it might be because rustdoc needs them in fenced form (@alexcrichton, did this change recently? Was it meant to change?), could you change them so they don't go out of date again:

```rust
fn inc_conditionally(...)
...
```

@nathantypanski

Copy link
Copy Markdown
Contributor Author

Sure, I'll update as mentioned.

@nathantypanski

Copy link
Copy Markdown
Contributor Author

Done; the tests for these docs run now and they pass.

Comment thread src/libcore/option.rs Outdated

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The convention is for functions to be used module-qualified, i.e. import std::option and call option::collect.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated as noted. Thanks for the style tip.

@nathantypanski

Copy link
Copy Markdown
Contributor Author

Oh, I missed the bit about closure form. I might as well go all-out and update it, rather than doing it halfway a hundred times.

This updates the documentation for result::collect() and
option::collect() to use the new-style syntax for vectors, instead of
the old ~[].

Also updates the code blocks for these docs so they will be tested
automatically.

closes rust-lang#14991
bors added a commit that referenced this pull request Jun 18, 2014
This updates the documentation for result::collect() and
option::collect() to use the new-style syntax for owned pointers and
vectors.

closes #14991
@bors bors closed this Jun 18, 2014
@bors
bors merged commit feceb12 into rust-lang:master Jun 18, 2014
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.

Docs for result::collect and option::collect should use boxed pointers and Vecs

3 participants