Skip to content

Commit

Permalink
Rollup merge of rust-lang#59372 - euclio:rename-trim, r=rkruppe
Browse files Browse the repository at this point in the history
add rustfix-able suggestions to trim_{left,right} deprecations

Fixes rust-lang#53802 (technically already fixed by rust-lang#58002, but that issue is about these methods).
  • Loading branch information
Centril authored Mar 27, 2019
2 parents 0052b80 + b34a71b commit 58bda0c
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions src/libcore/str/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3601,7 +3601,11 @@ impl str {
/// assert!(Some('ע') == s.trim_left().chars().next());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_deprecated(reason = "superseded by `trim_start`", since = "1.33.0")]
#[rustc_deprecated(
since = "1.33.0",
reason = "superseded by `trim_start`",
suggestion = "trim_start",
)]
pub fn trim_left(&self) -> &str {
self.trim_start()
}
Expand Down Expand Up @@ -3638,7 +3642,11 @@ impl str {
/// assert!(Some('ת') == s.trim_right().chars().rev().next());
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_deprecated(reason = "superseded by `trim_end`", since = "1.33.0")]
#[rustc_deprecated(
since = "1.33.0",
reason = "superseded by `trim_end`",
suggestion = "trim_end",
)]
pub fn trim_right(&self) -> &str {
self.trim_end()
}
Expand Down Expand Up @@ -3802,7 +3810,11 @@ impl str {
/// assert_eq!("12foo1bar12".trim_left_matches(x), "foo1bar12");
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_deprecated(reason = "superseded by `trim_start_matches`", since = "1.33.0")]
#[rustc_deprecated(
since = "1.33.0",
reason = "superseded by `trim_start_matches`",
suggestion = "trim_start_matches",
)]
pub fn trim_left_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str {
self.trim_start_matches(pat)
}
Expand Down Expand Up @@ -3840,7 +3852,11 @@ impl str {
/// assert_eq!("1fooX".trim_right_matches(|c| c == '1' || c == 'X'), "1foo");
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
#[rustc_deprecated(reason = "superseded by `trim_end_matches`", since = "1.33.0")]
#[rustc_deprecated(
since = "1.33.0",
reason = "superseded by `trim_end_matches`",
suggestion = "trim_end_matches",
)]
pub fn trim_right_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str
where P::Searcher: ReverseSearcher<'a>
{
Expand Down

0 comments on commit 58bda0c

Please sign in to comment.