Commit Graph

120 Commits

Author SHA1 Message Date
Manish Goregaokar 2d432ae35b Rollup merge of #74143 - pickfire:patch-2, r=jonas-schievink
Try remove unneeded ToString import in liballoc slice
2020-07-09 11:50:42 -07:00
Ivan Tham 0965443001 Remove unneeded ToString import in liballoc slice 2020-07-08 12:47:19 +08:00
Ivan Tham 7bc85e29c9 Liballoc use vec instead of vector
Keep congruency with other parts, full word vector is rarely used.
2020-07-08 12:44:43 +08:00
LeSeulArtichaut 39e29ce4d0 #[deny(unsafe_op_in_unsafe_fn)] in liballoc 2020-06-19 13:47:01 +02:00
Yuki Okushi 1a46159828 Explain why we shouldn't add inline attr to into_vec 2020-04-19 01:03:43 +09:00
bors 9d430cb351 Auto merge of #71204 - JohnTitor:into-vec, r=wesleywiser
perf: Remove inline attribute from `into_vec()`

It was introduced in #70565 and is likely related to this perf results: https://perf.rust-lang.org/compare.html?start=1edcfc83c6a08ddc5e63fc652b149baea0236e7c&end=d249d756374737eb014079901ac132f1e1ed905e&stat=instructions:u
Let's check if it's related to that.
r? @wesleywiser could you kick off perf check? I don't think I can do it.
2020-04-18 08:03:38 +00:00
Yuki Okushi c2f24a1d94 Remove inline attribute from into_vec() 2020-04-17 00:23:44 +09:00
Ralf Jung 88612e3657 big-O notation: parenthesis, multiplication and backticks 2020-04-15 14:33:45 +02:00
mi_sawa 408dc36980 Tighten time complexity on the doc 2020-04-14 23:51:03 +09:00
Dylan DPC 3cae0e479e Rollup merge of #70565 - Zoxc:inlines-query-system, r=davidtwco
Add inline attributes for functions used in the query system
2020-04-08 23:33:40 +02:00
Josh Stone e8339e820b Use split_at in slice's ToOwned::clone_into
It appears to codegen slightly more efficiently with `split_at` taking
two slices at once, rather than slicing across different calls.
2020-04-06 15:50:59 -07:00
Linus Färnstrand fff4f08398 Stop importing integer modules in liballoc 2020-04-05 11:22:01 +02:00
Linus Färnstrand c0ec0a27b3 Replace max/min_value() with MAX/MIN assoc consts 2020-04-03 09:33:10 +02:00
John Kåre Alsaker 87cdfb6e71 Add inline attributes for functions used in the query system 2020-03-30 14:37:44 +02:00
Matthias Krüger 74d68ea7eb don't create variable bindings just to return the bound value immediately (clippy::let_and_return) 2020-03-22 00:35:25 +01:00
king6cong 3c56a65bc4 reuse capacity variable in slice::repeat 2019-12-24 12:44:05 +08:00
David Tolnay 1c4d453969 Format liballoc with rustfmt 2019-11-29 20:25:07 -08:00
Lzu Tao 4a2ae451e3 Stabilize slice::repeat (feature repeat_generic_slice) 2019-10-02 04:48:15 +00:00
Lzu Tao 6c1b447f2e Remove unneeded fn main blocks from docs 2019-10-01 11:55:46 +00:00
Simon Sapin bbc9366c1a Update src/liballoc/slice.rs
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-07-09 18:19:10 +02:00
Simon Sapin d0635ee5f7 Update src/liballoc/slice.rs
Co-Authored-By: Mazdak Farrokhzad <twingoow@gmail.com>
2019-07-09 18:19:01 +02:00
Simon Sapin b62a77b490 Add joining slices of slices with a slice separator, not just a single item 2019-07-09 11:45:46 +02:00
Simon Sapin 283f6762ca Take separator by value in [T]::join 2019-07-09 11:45:46 +02:00
Simon Sapin 01d93bf595 Split the SliceConcat trait into Concat and Join 2019-07-09 11:45:46 +02:00
Simon Sapin 5397dfce77 Remove obsolete “should not have to exist” reasons 2019-07-09 11:45:46 +02:00
Simon Sapin e808d921dd Replace SliceConcatExt trait with inherent methods and SliceConcat helper trait
Before this change `SliceConcatExt` was an unstable extension trait
with stable methods. It was in the libstd prelude, so that its methods
could be used on the stable channel.

This replaces it with inherent methods,
which can be used without any addition to the prelude.
Since the methods are stable and very generic
(with for example a return type that depends on the types of parameters),
an helper trait is still needed.
But now that trait does not need to be in scope for the methods to be used.

Removing this depedency on the libstd prelude allows the methods to be used
in `#![no_std]` crate that use liballoc, which does not have its own
implicitly-imported prelude.
2019-07-05 11:49:30 +02:00
Mazdak Farrokhzad 3a8536edef Rollup merge of #61146 - czipperz:SliceConcatExt-connect-default-to-join, r=sfackler
SliceConcatExt::connect defaults to calling join

It makes sense to default a deprecated method to the new one.  Precedence example is `Error::cause` defaults to calling `Error::source`.
2019-06-22 01:42:30 +02:00
Ralf Jung 645f685e1b Box::into_vec: use Box::into_raw instead of mem::forget 2019-05-27 22:40:28 +02:00
Chris Gregory 3dd114e1cb SliceConcatExt::connect defaults to calling join 2019-05-24 21:04:56 -05:00
Alexander Regueiro 9f800457dd Ban multi-trait objects via trait aliases. 2019-05-20 16:12:49 +01:00
Ralf Jung 50c615baa2 warn(missing_docs) in liballoc, and add missing docs 2019-04-15 16:35:50 +02:00
Scott McMurray 317f15304e Revert "Remove mentions of unstable sort_by_cached key from stable documentation"
This reverts commit 9c7b69e179.
2019-02-12 22:26:44 -08:00
Scott McMurray 3777b86f9b Stabilize slice_sort_by_cached_key 2019-02-12 22:26:44 -08:00
Alexander Regueiro 99ed06eb88 libs: doc comments 2019-02-10 23:57:25 +00:00
Mazdak Farrokhzad 2396780cda liballoc: revert nested imports style changes. 2019-02-03 08:27:44 +01:00
Mazdak Farrokhzad 748970dfa9 liballoc: apply uniform_paths. 2019-02-02 11:05:20 +01:00
Mazdak Farrokhzad 3bfa0a35f6 liballoc: prefer imports of borrow from libcore. 2019-02-02 10:53:27 +01:00
Mazdak Farrokhzad f09f62f62c liballoc: adjust abolute imports + more import fixes. 2019-02-02 10:34:36 +01:00
Mazdak Farrokhzad 7693e3e666 liballoc: refactor & fix some imports. 2019-02-02 10:14:40 +01:00
Mazdak Farrokhzad e6e27924e1 liballoc: cargo check passes on 2018 2019-02-02 08:36:45 +01:00
Mark Rousskov 2a663555dd Remove licenses 2018-12-25 21:08:33 -07:00
bors 9cb38a84e7 Auto merge of #56463 - ljedrz:slice_concat_join, r=nikic
slice: tweak concat & join

- use `sum` instead of `fold` (readability)
- adjust the capacity for `join` - the number of separators is `n - 1`, not `n`; proof:
```
fn main() {
    let a = [[1, 2], [4, 5]];
    let v = a.join(&3);

    assert_ne!(v.len(), v.capacity()); // len is 5, capacity is 6
}
```
2018-12-09 22:39:44 +00:00
Alexander Regueiro ee89c088b0 Various minor/cosmetic improvements to code 2018-12-07 23:53:34 +00:00
ljedrz ae53273021 slice: tweak concat & join 2018-12-03 16:22:27 +01:00
bors f3adec65dd Auto merge of #53918 - Havvy:doc-sort-by, r=GuillaumeGomez
Doc total order requirement of sort(_unstable)_by

I took the definition of what a total order is from the Ord trait
docs. I specifically put "elements of the slice" because if you
have a slice of f64s, but know none are NaN, then sorting by
partial ord is total in this case. I'm not sure if I should give
such an example in the docs or not.

r? @GuillaumeGomez
2018-11-22 06:50:18 +00:00
Sebastian Dröge 52cc6fde4b Stabilize slice::rchunks(), rchunks_mut(), rchunks_exact(), rchunk_exact_mut()
Fixes #55177
2018-10-18 18:51:56 +03:00
Sebastian Dröge b08ca2958e Stabilize slice::chunks_exact() and slice::chunks_exact_mut()
Fixes #47115
2018-10-18 18:51:56 +03:00
Sebastian Dröge 80a8e5c1f7 Add slice::rchunks(), rchunks_mut(), rchunks_exact() and rchunks_exact_mut()
These work exactly like the normal chunks iterators but start creating
chunks from the end of the slice.

See #55177 for the tracking issue
2018-10-18 10:38:05 +03:00
Havvy (Ryan Scheel) 99bed21101 Linkify types in docs 2018-10-05 17:41:43 -07:00
Havvy (Ryan Scheel) b911dba40b Slice total example: Move closer to total defn 2018-10-05 17:41:43 -07:00