Skip to content

Commit c7b05b7

Browse files
committed
Remove generic parameters from Output trait.
Rationale: * In a next commit, we would store a trait reference in `PrettyFormatter<T>::out` instead of using a concrete type `OutputLocation<T>`. * If the trait had generic methods, we would get compilation error "cannot be made into an object" in that next commit.
1 parent 8cd2889 commit c7b05b7

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

library/test/src/console.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,8 @@ impl<T: Write> OutputLocation<T> {
5757
self.flush()
5858
}
5959

60-
pub fn write_plain<S: AsRef<str>>(&mut self, s: S) -> io::Result<()> {
61-
let s = s.as_ref();
62-
self.write_all(s.as_bytes())?;
60+
pub fn write_plain(&mut self, word: &str) -> io::Result<()> {
61+
self.write_all(word.as_bytes())?;
6362
self.flush()
6463
}
6564
}

library/test/src/formatters/pretty.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ impl<T: Write> PrettyFormatter<T> {
6969
}
7070

7171
fn write_plain<S: AsRef<str>>(&mut self, s: S) -> io::Result<()> {
72+
let s = s.as_ref();
7273
self.out.write_plain(s)
7374
}
7475

0 commit comments

Comments
 (0)