Skip to content

Commit 86cf731

Browse files
committed
use impl trait
1 parent 1ae4caa commit 86cf731

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

src/interpret.rs

+3-16
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,7 @@ use unicode_segmentation::UnicodeSegmentation;
2121
///
2222
/// # Errors
2323
/// Will return `Err` if the given program performs an illegal operation or an io error occurs. See [`Error`](./enum.Error.html).
24-
pub fn run_program_from_read<P, I, O>(program: P, input: I, mut output: O) -> Result<(), Error>
25-
where
26-
P: Read,
27-
I: Read,
28-
O: Write,
29-
{
24+
pub fn run_program_from_read(program: impl Read, input: impl Read, mut output: impl Write) -> Result<(), Error> {
3025
let mut program = BufReader::new(program);
3126
let mut input = BufReader::new(input);
3227

@@ -225,11 +220,7 @@ where
225220
///
226221
/// # Errors
227222
/// Will return `Err` if the given program performs an illegal operation or an io error occurs. See [`Error`](./enum.Error.html).
228-
pub fn run_program_str<I, O>(program: &str, input: I, output: O) -> Result<(), Error>
229-
where
230-
I: Read,
231-
O: Write,
232-
{
223+
pub fn run_program_str(program: &str, input: impl Read, output: impl Write) -> Result<(), Error> {
233224
let parsed = parse_program_str(program);
234225
run_program(&parsed, input, output)
235226
}
@@ -254,11 +245,7 @@ where
254245
///
255246
/// # Errors
256247
/// Will return `Err` if the given program performs an illegal operation or an io error occurs. See [`Error`](./enum.Error.html).
257-
pub fn run_program<I, O>(program: &[Command<'_>], input: I, mut output: O) -> Result<(), Error>
258-
where
259-
I: Read,
260-
O: Write,
261-
{
248+
pub fn run_program(program: &[Command<'_>], input: impl Read, mut output: impl Write) -> Result<(), Error> {
262249
let mut input = BufReader::new(input);
263250
let mut in_line = String::new();
264251

0 commit comments

Comments
 (0)