about summary refs log tree commit diff
path: root/src/libcore/str
AgeCommit message (Collapse)AuthorLines
2019-04-25ignore-tidy-filelength on all files with greater than 3000 linesvarkor-0/+2
2019-04-19Rollup merge of #60098 - Centril:libcore-deny-more, r=varkorMazdak Farrokhzad-25/+25
libcore: deny `elided_lifetimes_in_paths` r? @varkor
2019-04-19Rollup merge of #60023 - koalatux:nth-back, r=scottmcmMazdak Farrokhzad-0/+5
implement specialized nth_back() for Bytes, Fuse and Enumerate Hi, After my first PR has been successfully merged, here is my second pull request :-) Also this PR contains some specializations for the problem discussed in #54054.
2019-04-19libcore: deny more...Mazdak Farrokhzad-25/+25
2019-04-18libcore => 2018Taiki Endo-20/+19
2019-04-16implement nth_back for BytesAdrian Friedli-0/+5
2019-04-12Fix paste error in split_ascii_whitespace docs.Scott Olson-1/+1
2019-03-22add suggestions to trim_{left,right} deprecationsAndy Russell-4/+20
2019-03-11Improvements to comments in libstd, libcore, liballoc.Alexander Regueiro-4/+4
2019-02-27Replace `s` with `self` in docs for str methods taking self.Trevor Spiteri-3/+3
2019-02-20Rollup merge of #58553 - scottmcm:more-ihle, r=Centrilkennytm-1/+1
Use more impl header lifetime elision Inspired by seeing explicit lifetimes on these two: - https://doc.rust-lang.org/nightly/std/slice/struct.Iter.html#impl-FusedIterator - https://doc.rust-lang.org/nightly/std/primitive.u32.html#impl-Not And a follow-up to https://github.com/rust-lang/rust/pull/54687, that started using IHLE in libcore. Most of the changes in here fall into two big categories: - Removing lifetimes from common traits that can essentially never user a lifetime from an input (particularly `Drop`, `Debug`, and `Clone`) - Forwarding impls that are only possible because the lifetime doesn't matter (like `impl<R: Read + ?Sized> Read for &mut R`) I omitted things that seemed like they could be more controversial, like the handful of iterators that have a `Item: 'static` despite the iterator having a lifetime or the `PartialEq` implementations [where the flipped one cannot elide the lifetime](https://internals.rust-lang.org/t/impl-type-parameter-aliases/9403/2?u=scottmcm). I also removed two lifetimes that turned out to be completely unused; see https://github.com/rust-lang/rust/issues/41960#issuecomment-464557423
2019-02-17Use more impl header lifetime elisionScott McMurray-1/+1
There are two big categories of changes in here - Removing lifetimes from common traits that can essentially never user a lifetime from an input (particularly `Drop` & `Debug`) - Forwarding impls that are only possible because the lifetime doesn't matter (like `impl<R: Read + ?Sized> Read for &mut R`) I omitted things that seemed like they could be more controversial, like the handful of iterators that have a `Item: 'static` despite the iterator having a lifetime or the `PartialEq` implementations where the flipped one cannot elide the lifetime.
2019-02-13Rollup merge of #58200 - RalfJung:str-as-mut-ptr, r=SimonSapinMazdak Farrokhzad-7/+23
fix str mutating through a ptr derived from &self Found by Miri: In `get_unchecked_mut` (also used by the checked variants internally) uses `str::as_ptr` to create a mutable reference, but `as_ptr` takes `&self`. This means the mutable references we return here got created from a shared reference, which violates the shared-references-are-read-only discipline! For this by using a newly introduced `as_mut_ptr` instead.
2019-02-12Auto merge of #58051 - SimonSapin:str_escape, r=alexcrichtonbors-114/+243
Stabilize str::escape_* methods with new return types… … that implement `Display` and `Iterator<Item=char>`, as proposed in FCP: https://github.com/rust-lang/rust/issues/27791#issuecomment-376864727
2019-02-12Add doctests for str::escape_*Simon Sapin-3/+93
2019-02-12Move str::escape_* to libcoreSimon Sapin-1/+125
2019-02-12Add internal impl_fn_for_zst macro for "named closure types"Simon Sapin-113/+28
2019-02-10libs: doc commentsAlexander Regueiro-9/+9
2019-02-10tests: doc commentsAlexander Regueiro-10/+10
2019-02-10rustc: doc commentsAlexander Regueiro-4/+4
2019-02-07also fix bad use of shared ref in split_at_mutRalf Jung-1/+1
2019-02-06add tracking issueRalf Jung-1/+1
2019-02-06remove now-unneeded raw ptr castsRalf Jung-3/+3
2019-02-05fix str mutating through a ptr derived from &selfRalf Jung-3/+19
2019-02-04update split docsgaryemerson-14/+14
Some confusion about split popped up at https://news.ycombinator.com/item?id=19080931 since the docs sorta sound like `&str`, `char` and closures are the only types that can be patterns. cc @steveklabnik
2019-02-01Stabilize split_ascii_whitespaceSimon Sapin-6/+5
Tracking issue FCP to merge: https://github.com/rust-lang/rust/issues/48656#issuecomment-442372750
2019-01-31Rollup merge of #58005 - vitiral:docs_trim_start_matches, r=ManishearthMazdak Farrokhzad-8/+8
update docs for fix_start/end_matches fixes #57686:
2019-01-31Rollup merge of #57106 - matthiaskrgr:trim_must_use, r=sfacklerMazdak Farrokhzad-0/+12
Mark str::trim.* functions as #[must_use]. The functions return a reference to a new object and do not modify in-place as the following code shows: ```` let s = String::from(" hello "); s.trim(); assert_eq!(s, " hello "); ```` The new reference should be bound to a variable as now indicated by #[must_use].
2019-01-30fix #57686: update docs for fix_start/end_matchesRett Berg-8/+8
2019-01-22Move TrustedRandomAccess into Zip moduleClar Fon-2/+1
2019-01-19Make `str` indexing generic on `SliceIndex`.Alexis Hunt-177/+119
2019-01-13Rollup merge of #57454 - sinkuu:fmt_cleanup, r=joshtriplettMazdak Farrokhzad-2/+1
Some cleanups for core::fmt
2019-01-10note that FromStr does not work for borrowed typesSteve Klabnik-2/+6
Fixes #47757
2019-01-09Misc cleanupsShotaro Yamada-2/+1
2018-12-26modify remaining #[must_use[ messagesMatthias Krüger-5/+5
2018-12-26Update src/libcore/str/mod.rs, tweak must_use message Zack M. Davis-1/+1
trimmed string is returned as a slice instead of a new allocation Co-Authored-By: matthiaskrgr <matthias.krueger@famsik.de>
2018-12-26mark str::string::String.trim.* functions as #[must_use].Matthias Krüger-0/+12
The functions return a reference to a new object and do not modify in-place as the following code shows: ```` let s = String::from(" hello "); s.trim(); assert_eq!(s, " hello "); ```` The new reference should be bound to a variable as now indicated by #[must_use].
2018-12-25Remove licensesMark Rousskov-30/+0
2018-12-07Various minor/cosmetic improvements to codeAlexander Regueiro-3/+3
2018-12-05Rollup merge of #56119 - frewsxcv:frewsxcv-option-carrier, r=TimNNPietro Albini-4/+3
Utilize `?` instead of `return None`. None
2018-12-04Utilize `?` instead of `return None`.Corey Farwell-4/+3
2018-11-26Remove unsafe `unsafe` inner function.Corey Farwell-5/+2
Within this `Iterator` implementation, a function `unsafe_get` is defined which unsafely allows _unchecked_ indexing of any element in a slice. This should be marked as _unsafe_, but it is not. To address this issue, I removed that inner function.
2018-11-22std::str Adapt documentation to realityAdrian Heine né Lang-4/+2
2018-11-13Rollup merge of #55870 - waywardmonkeys:typo-fixes, r=wesleywiserkennytm-1/+1
Fix typos.
2018-11-11Fix typos.Bruce Mitchener-1/+1
2018-11-10revert making internal APIs const fn.Mazdak Farrokhzad-4/+4
2018-11-10reduce list to functions callable in const ctx.Mazdak Farrokhzad-2/+2
2018-11-10constify parts of libcore.Mazdak Farrokhzad-7/+6
2018-09-29Use impl_header_lifetime_elision in libcoreScott McMurray-19/+19
2018-09-05Auto merge of #52994 - varkor:trim_direction, r=alexcrichtonbors-13/+157
Add trim_start, trim_end etc.; deprecate trim_left, trim_right, etc. in future Adds the methods: `trim_start`, `trim_end`, `trim_start_matches` and `trim_end_matches`. Deprecates `trim_left`, `trim_right`, `trim_left_matches` and `trim_right_matches` starting from Rust 1.33.0, three versions from when they'll initially be marked as being deprecated, using the future deprecation from https://github.com/rust-lang/rust/issues/30785 and https://github.com/rust-lang/rust/pull/51681. Fixes https://github.com/rust-lang/rust/issues/30459.