about summary refs log tree commit diff
path: root/src/libcore/str
AgeCommit message (Collapse)AuthorLines
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.
2018-08-22use char pattern for single-character splits: a.split("x") -> a.split('x')Matthias Krüger-1/+1
2018-08-20Replace usages of ptr::offset with ptr::{add,sub}.Corey Farwell-7/+7
2018-08-12Rollup merge of #53273 - frewsxcv:frewsxcv-ufffd, r=GuillaumeGomezGuillaume Gomez-1/+4
Add links to std::char::REPLACEMENT_CHARACTER from docs. There are a few places where we mention the replacement character in the docs, and it could be helpful for users to utilize the constant which is available in the standard library, so let’s link to it!
2018-08-12Rollup merge of #53059 - ljedrz:unneeded_returns, r=kennytmGuillaume Gomez-2/+2
Remove explicit returns where unnecessary
2018-08-11Add links to std::char::REPLACEMENT_CHARACTER from docs.Corey Farwell-1/+4
There are a few places where we mention the replacement character in the docs, and it could be helpful for users to utilize the constant which is available in the standard library, so let’s link to it!
2018-08-05Make features stable and clarify examplesvarkor-22/+8
2018-08-04Remove explicit returns where unnecessaryljedrz-2/+2