From b3baa835fc4f92376c1528fc7f0ea7e988773fee Mon Sep 17 00:00:00 2001 From: Benjamin Hoffmeyer Date: Mon, 20 Nov 2017 13:37:56 -0500 Subject: [PATCH 1/2] Fix doc tests for trim_right_matches --- src/liballoc/str.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/liballoc/str.rs b/src/liballoc/str.rs index f68ee847eb3ab..026825b327564 100644 --- a/src/liballoc/str.rs +++ b/src/liballoc/str.rs @@ -1734,7 +1734,7 @@ impl str { /// A more complex pattern, using a closure: /// /// ``` - /// assert_eq!("1fooX".trim_left_matches(|c| c == '1' || c == 'X'), "fooX"); + /// assert_eq!("1fooX".trim_right_matches(|c| c == '1' || c == 'X'), "fooX"); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn trim_right_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str From f69d4d44d8de9edbf94e240bbd2ba252c6937179 Mon Sep 17 00:00:00 2001 From: Benjamin Hoffmeyer Date: Mon, 20 Nov 2017 13:47:42 -0500 Subject: [PATCH 2/2] Fix result for assert_eq --- src/liballoc/str.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/liballoc/str.rs b/src/liballoc/str.rs index 026825b327564..6e8515f0b3625 100644 --- a/src/liballoc/str.rs +++ b/src/liballoc/str.rs @@ -1734,7 +1734,7 @@ impl str { /// A more complex pattern, using a closure: /// /// ``` - /// assert_eq!("1fooX".trim_right_matches(|c| c == '1' || c == 'X'), "fooX"); + /// assert_eq!("1fooX".trim_right_matches(|c| c == '1' || c == 'X'), "1foo"); /// ``` #[stable(feature = "rust1", since = "1.0.0")] pub fn trim_right_matches<'a, P: Pattern<'a>>(&'a self, pat: P) -> &'a str