Skip to content

Commit ddff2ed

Browse files
committed
Remove unnecessary adapter
1 parent 68fe518 commit ddff2ed

File tree

1 file changed

+2
-23
lines changed

1 file changed

+2
-23
lines changed

src/libcore/fmt/mod.rs

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -191,29 +191,8 @@ pub trait Write {
191191
/// assert_eq!(&buf, "world");
192192
/// ```
193193
#[stable(feature = "rust1", since = "1.0.0")]
194-
fn write_fmt(&mut self, args: Arguments) -> Result {
195-
// This Adapter is needed to allow `self` (of type `&mut
196-
// Self`) to be cast to a Write (below) without
197-
// requiring a `Sized` bound.
198-
struct Adapter<'a,T: ?Sized +'a>(&'a mut T);
199-
200-
impl<T: ?Sized> Write for Adapter<'_, T>
201-
where T: Write
202-
{
203-
fn write_str(&mut self, s: &str) -> Result {
204-
self.0.write_str(s)
205-
}
206-
207-
fn write_char(&mut self, c: char) -> Result {
208-
self.0.write_char(c)
209-
}
210-
211-
fn write_fmt(&mut self, args: Arguments) -> Result {
212-
self.0.write_fmt(args)
213-
}
214-
}
215-
216-
write(&mut Adapter(self), args)
194+
fn write_fmt(mut self: &mut Self, args: Arguments) -> Result {
195+
write(&mut self, args)
217196
}
218197
}
219198

0 commit comments

Comments
 (0)