summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShotaro Yamada <sinkuu@sinkuu.xyz>2019-01-06 15:33:11 +0900
committerShotaro Yamada <sinkuu@sinkuu.xyz>2019-01-06 15:33:11 +0900
commitddff2ed649340fc07d3f6a3357c85b61d4b22b5f (patch)
tree0b20c167def88a4a035d97593ec78f4213acf1b5
parent68fe5182c967259ef89dbe313e4bf80f45a53e7e (diff)
downloadrust-ddff2ed649340fc07d3f6a3357c85b61d4b22b5f.tar.gz
Remove unnecessary adapter
-rw-r--r--src/libcore/fmt/mod.rs25
1 files changed, 2 insertions, 23 deletions
diff --git a/src/libcore/fmt/mod.rs b/src/libcore/fmt/mod.rs
index ec1aeb8a7d1..bb6f511acf7 100644
--- a/src/libcore/fmt/mod.rs
+++ b/src/libcore/fmt/mod.rs
@@ -191,29 +191,8 @@ pub trait Write {
/// assert_eq!(&buf, "world");
/// ```
#[stable(feature = "rust1", since = "1.0.0")]
- fn write_fmt(&mut self, args: Arguments) -> Result {
- // This Adapter is needed to allow `self` (of type `&mut
- // Self`) to be cast to a Write (below) without
- // requiring a `Sized` bound.
- struct Adapter<'a,T: ?Sized +'a>(&'a mut T);
-
- impl<T: ?Sized> Write for Adapter<'_, T>
- where T: Write
- {
- fn write_str(&mut self, s: &str) -> Result {
- self.0.write_str(s)
- }
-
- fn write_char(&mut self, c: char) -> Result {
- self.0.write_char(c)
- }
-
- fn write_fmt(&mut self, args: Arguments) -> Result {
- self.0.write_fmt(args)
- }
- }
-
- write(&mut Adapter(self), args)
+ fn write_fmt(mut self: &mut Self, args: Arguments) -> Result {
+ write(&mut self, args)
}
}