Rollup merge of #59372 - euclio:rename-trim, r=rkruppe

add rustfix-able suggestions to trim_{left,right} deprecations

Fixes #53802 (technically already fixed by #58002, but that issue is about these methods).
This commit is contained in:
Josh Stone 2019-03-27 18:15:28 -07:00 committed by GitHub
commit a4bf8557b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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()
}
@ -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()
}
@ -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)
}
@ -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>
{