Skip to content

Remove ~[] from librand, rename Rng.shuffle_mut to .shuffle #13177

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 2, 2014

Conversation

huonw
Copy link
Member

@huonw huonw commented Mar 28, 2014

Remove ~[] from librand, rename Rng.shuffle_mut to .shuffle.

See commits.

@huonw
Copy link
Member Author

huonw commented Mar 28, 2014

(This has got some minor problems where I forgot to update the testsuite; I don't have time to fix it now, but a review would still be appreciated, since fixing those problems is just adjusting the various type hints.)

@lilyball
Copy link
Contributor

You should just remove shuffle() and rename shuffle_mut() to shuffle(). I'm not sure why we even have a version that takes a ~[T] when that's not necessary for the actual shuffling.

@sfackler
Copy link
Member

I agree with @kballard

@huonw
Copy link
Member Author

huonw commented Mar 30, 2014

@kballard shuffle presumably existed for the same reason that append and append_one exist: allowing for writing code in a more functional style. But yes, I like the idea of removing it entirely.

@huonw huonw changed the title Remove ~[] from librand, deprecate Rng.shuffle Remove ~[] from librand, rename Rng.shuffle_mut to .shuffle Apr 1, 2014
@huonw
Copy link
Member Author

huonw commented Apr 1, 2014

Updated with the suggested shuffle change.

@alexcrichton
Copy link
Member

r=me with my comment

huonw added 2 commits April 2, 2014 23:29
There are a few instances of them in tests which are using functions
from std etc. that still are using ~[].
Deprecates the `shuffle_mut` name in favour of `shuffle` too.

In future there will be many different types of owned
vectors/vector-likes (e.g. DST's ~[], Vec, SmallVec, Rope, ...), and so
privileging just `Vec` with the "functional" `shuffle` method is silly.
bors added a commit that referenced this pull request Apr 2, 2014
Remove ~[] from librand, rename Rng.shuffle_mut to .shuffle.

See commits.
@bors bors closed this Apr 2, 2014
@bors bors merged commit 846d1c7 into rust-lang:master Apr 2, 2014
@huonw huonw deleted the devec-rand branch June 27, 2014 06:47
flip1995 pushed a commit to flip1995/rust that referenced this pull request Aug 8, 2024
…config, r=xFrednet

Fix broken list for lints config

Follow-up of rust-lang#13166.

Finally figured out that it was a transformation and not the source that was the problem. It now looks like this:

![Screenshot from 2024-07-29 16-29-10](https://github.com/user-attachments/assets/4b89b3fe-8f85-47b8-8d9a-505badeaeac4)

r? `@xFrednet`

changelog: none
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.

5 participants