| Age | Commit message (Collapse) | Author | Lines | |
|---|---|---|---|---|
| 2022-03-25 | Adjust tests for isize::MAX allocation always being checked | CAD97 | -88/+38 | |
| 2022-03-10 | Use implicit capture syntax in format_args | T-O-R-U-S | -2/+2 | |
| This updates the standard library's documentation to use the new syntax. The documentation is worthwhile to update as it should be more idiomatic (particularly for features like this, which are nice for users to get acquainted with). The general codebase is likely more hassle than benefit to update: it'll hurt git blame, and generally updates can be done by folks updating the code if (and when) that makes things more readable with the new format. A few places in the compiler and library code are updated (mostly just due to already having been done when this commit was first authored). | ||||
| 2022-01-09 | eplace usages of vec![].into_iter with [].into_iter | Lucas Kent | -1/+1 | |
| 2021-08-07 | Use assert_matches! instead of if let {} else | Kornel | -80/+73 | |
| 2021-07-24 | Hide allocator details from TryReserveError | Kornel | -23/+51 | |
| 2021-03-05 | Implement String::remove_matches | Josh Cotton | -0/+27 | |
| 2021-01-18 | Fix soundness issue for `replace_range` and `range` | dylni | -0/+50 | |
| 2020-10-29 | Added test for issue #78498 | Giacomo Stevanato | -0/+15 | |
| 2020-09-19 | Use `T::BITS` instead of `size_of::<T> * 8`. | Mara Bos | -3/+2 | |
| 2020-09-16 | Rollup merge of #75882 - pickfire:patch-6, r=jyn514 | Dylan DPC | -2/+2 | |
| Use translated variable for test string Test should be educative, added english translation and pronounciation. | ||||
| 2020-09-16 | Rollup merge of #75146 - tmiasko:range-overflow, r=Mark-Simulacrum | Dylan DPC | -0/+29 | |
| Detect overflow in proc_macro_server subspan * Detect overflow in proc_macro_server subspan * Add tests for overflow in Vec::drain * Add tests for overflow in String / VecDeque operations using ranges | ||||
| 2020-09-13 | Optimize behavior of vec.split_off(0) (take all) | Rich Kadel | -0/+4 | |
| Optimization improvement to `split_off()` so the performance meets the intuitively expected behavior when `at == 0`, avoiding the current behavior of copying the entire vector. The change honors documented behavior that the method leaves the original vector's "previous capacity unchanged". This improvement better supports the pattern for building and flushing a buffer of elements, such as the following: ```rust let mut vec = Vec::new(); loop { vec.push(something); if condition_is_met { process(vec.split_off(0)); } } ``` `Option` wrapping is the first alternative I thought of, but is much less obvious and more verbose: ```rust let mut capacity = 1; let mut vec: Option<Vec<Stuff>> = None; loop { vec.get_or_insert_with(|| Vec::with_capacity(capacity)).push(something); if condition_is_met { capacity = vec.capacity(); process(vec.take().unwrap()); } } ``` Directly applying `mem::replace()` could work, but `mem::` functions are typically a last resort, when a developer is actively seeking better performance than the standard library provides, for example. The benefit of the approach to this change is it does not change the existing API contract, but improves the peformance of `split_off(0)` for `Vec`, `String` (which delegates `split_off()` to `Vec`), and any other existing use cases. This change adds tests to validate the behavior of `split_off()` with regard to capacity, as originally documented, and confirm that behavior still holds, when `at == 0`. The change is an implementation detail, and does not require a documentation change, but documenting the new behavior as part of its API contract may benefit future users. (Let me know if I should make that documentation update.) Note, for future consideration: I think it would be helpful to introduce an additional method to `Vec` (if not also to `String`): ``` pub fn take_all(&mut self) -> Self { self.split_off(0) } ``` This would make it more clear how `Vec` supports the pattern, and make it easier to find, since the behavior is similar to other `take()` methods in the Rust standard library. | ||||
| 2020-09-06 | Move test-cases in string.rs | Ayush Kumar Mishra | -0/+8 | |
| 2020-09-04 | Add tests for overflow in String / VecDeque operations using ranges | Tomasz Miąsko | -0/+29 | |
| 2020-08-24 | Use translated variable for test string | Ivan Tham | -2/+2 | |
| Test should be educative, added english translation and pronounciation. | ||||
| 2020-07-27 | mv std libs to library/ | mark | -0/+723 | |
