From fd2282388140ea0f370ee25c82f00be81c2f822c Mon Sep 17 00:00:00 2001 From: Trevor Spiteri Date: Sat, 1 Feb 2020 22:19:28 +0100 Subject: [PATCH] implement AsMut for String --- src/liballoc/string.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/liballoc/string.rs b/src/liballoc/string.rs index 96f871d8897..99725917b5d 100644 --- a/src/liballoc/string.rs +++ b/src/liballoc/string.rs @@ -2208,6 +2208,14 @@ fn as_ref(&self) -> &str { } } +#[stable(feature = "string_as_mut", since = "1.43.0")] +impl AsMut for String { + #[inline] + fn as_mut(&mut self) -> &mut str { + self + } +} + #[stable(feature = "rust1", since = "1.0.0")] impl AsRef<[u8]> for String { #[inline]