-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
739: Complete `Permutations::size_hint` r=jswrenn a=Philippe-Cholet `@phimuemue` This series of size hint/count improvements ends where it started: with a TODO I wanted to fix. The end user will mostly enjoy that `(0..n).permutations(k).map(...).collect_vec()` will now allocate to the resulting vector in _one go_ (`PermutationState::StartUnknownLen` case). In the first commit, you probably will want me to unwrap but `panic!(message)` is more similar to `expect` than `unwrap`. Which is why I previously used `expect` too. The 2nd commit (about `enough_vals`) is off topic but I really don't see why it would not be a (minor) improvement. I have a test `permutations_inexact_size_hints` ready if you want (similar to `combinations_inexact_size_hints`). Co-authored-by: Philippe-Cholet <phcholet@orange.fr>
- Loading branch information
Showing
3 changed files
with
65 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters