From 1d185745ec7976ca3f9b08303408c3507106b497 Mon Sep 17 00:00:00 2001 From: Hatter Jiang Date: Mon, 20 Apr 2020 01:20:37 +0800 Subject: [PATCH] add flush --- single_file_tests/input.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/single_file_tests/input.rs b/single_file_tests/input.rs index 90b7c5a..9f1daef 100644 --- a/single_file_tests/input.rs +++ b/single_file_tests/input.rs @@ -1,9 +1,9 @@ -use std::{ io, error::Error, }; +use std::{ io, io::Write, error::Error, }; fn main() -> Result<(), Box> { let mut input = String::new(); - println!("Please input: "); - // io::stdout().flush().ok(); + print!("Please input: "); + io::stdout().flush().ok(); io::stdin().read_line(&mut input)?; println!("You typed: {}", input.trim());