Skip to content

Commit 58bda0c

Browse files
authored
Rollup merge of rust-lang#59372 - euclio:rename-trim, r=rkruppe
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).
2 parents 0052b80 + b34a71b commit 58bda0c

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

src/libcore/str/mod.rs

+20-4
Original file line numberDiff line numberDiff line change
@@ -3601,7 +3601,11 @@ impl str {
36013601
/// assert!(Some('ע') == s.trim_left().chars().next());
36023602
/// ```
36033603
#[stable(feature = "rust1", since = "1.0.0")]
3604-
#[rustc_deprecated(reason = "superseded by `trim_start`", since = "1.33.0")]
3604+
#[rustc_deprecated(
3605+
since = "1.33.0",
3606+
reason = "superseded by `trim_start`",
3607+
suggestion = "trim_start",
3608+
)]
36053609
pub fn trim_left(&self) -> &str {
36063610
self.trim_start()
36073611
}
@@ -3638,7 +3642,11 @@ impl str {
36383642
/// assert!(Some('ת') == s.trim_right().chars().rev().next());
36393643
/// ```
36403644
#[stable(feature = "rust1", since = "1.0.0")]
3641-
#[rustc_deprecated(reason = "superseded by `trim_end`", since = "1.33.0")]
3645+
#[rustc_deprecated(
3646+
since = "1.33.0",
3647+
reason = "superseded by `trim_end`",
3648+
suggestion = "trim_end",
3649+
)]
36423650
pub fn trim_right(&self) -> &str {
36433651
self.trim_end()
36443652
}
@@ -3802,7 +3810,11 @@ impl str {
38023810
/// assert_eq!("12foo1bar12".trim_left_matches(x), "foo1bar12");
38033811
/// ```
38043812
#[stable(feature = "rust1", since = "1.0.0")]
3805-
#[rustc_deprecated(reason = "superseded by `trim_start_matches`", since = "1.33.0")]
3813+
#[rustc_deprecated(
3814+
since = "1.33.0",
3815+
reason = "superseded by `trim_start_matches`",
3816+
suggestion = "trim_start_matches",
3817+
)]
38063818
pub fn trim_left_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str {
38073819
self.trim_start_matches(pat)
38083820
}
@@ -3840,7 +3852,11 @@ impl str {
38403852
/// assert_eq!("1fooX".trim_right_matches(|c| c == '1' || c == 'X'), "1foo");
38413853
/// ```
38423854
#[stable(feature = "rust1", since = "1.0.0")]
3843-
#[rustc_deprecated(reason = "superseded by `trim_end_matches`", since = "1.33.0")]
3855+
#[rustc_deprecated(
3856+
since = "1.33.0",
3857+
reason = "superseded by `trim_end_matches`",
3858+
suggestion = "trim_end_matches",
3859+
)]
38443860
pub fn trim_right_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str
38453861
where P::Searcher: ReverseSearcher<'a>
38463862
{

0 commit comments

Comments
 (0)