From a95d9da2ee95a7fbd5a48b4229f3ea972ddd6238 Mon Sep 17 00:00:00 2001 From: Robert Vojta Date: Fri, 13 Sep 2019 15:11:48 +0200 Subject: [PATCH 1/4] Fix test_parse_utf8 test Signed-off-by: Robert Vojta --- crossterm_input/src/input/unix_input.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crossterm_input/src/input/unix_input.rs b/crossterm_input/src/input/unix_input.rs index 90456dbcf..e8115c6f3 100644 --- a/crossterm_input/src/input/unix_input.rs +++ b/crossterm_input/src/input/unix_input.rs @@ -487,10 +487,10 @@ where #[test] fn test_parse_utf8() { let st = "abcéŷ¤£€ù%323"; - let ref mut bytes = st.bytes().map(|x| Ok(x)); + let ref mut bytes = st.bytes(); let chars = st.chars(); for c in chars { - let b = bytes.next().unwrap().unwrap(); + let b = bytes.next().unwrap(); assert_eq!(c, parse_utf8_char(b, bytes).unwrap()); } } From 3f0a19cd74540f62f49000f88ae4132c8e587742 Mon Sep 17 00:00:00 2001 From: Robert Vojta Date: Fri, 13 Sep 2019 15:12:05 +0200 Subject: [PATCH 2/4] Fix docstring examples Signed-off-by: Robert Vojta --- crossterm_input/src/input/input.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crossterm_input/src/input/input.rs b/crossterm_input/src/input/input.rs index bab87177a..fa4b4e6cf 100644 --- a/crossterm_input/src/input/input.rs +++ b/crossterm_input/src/input/input.rs @@ -44,11 +44,11 @@ impl TerminalInput { /// /// # Example /// ```rust - /// let input = input(); - /// match input.read_line() { + /// let input = crossterm_input::input(); + /// match input.read_line() { /// Ok(s) => println!("string typed: {}", s), /// Err(e) => println!("error: {}", e), - /// } + /// } /// ``` pub fn read_line(&self) -> io::Result { let mut rv = String::new(); @@ -61,12 +61,12 @@ impl TerminalInput { /// Read one character from the user input /// /// ```rust - /// let input = input(); + /// let input = crossterm_input::input(); /// - /// match input.read_char() { + /// match input.read_char() { /// Ok(c) => println!("character pressed: {}", c), /// Err(e) => println!("error: {}", e), - /// } + /// } /// ``` pub fn read_char(&self) -> io::Result { self.input.read_char() From 945e1ba7d13c0cbf7202bf0531f0feee7183bd90 Mon Sep 17 00:00:00 2001 From: Robert Vojta Date: Fri, 13 Sep 2019 23:53:47 +0200 Subject: [PATCH 3/4] Remove crossterm_input & ignore examples in tests Signed-off-by: Robert Vojta --- crossterm_input/src/input/input.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/crossterm_input/src/input/input.rs b/crossterm_input/src/input/input.rs index fa4b4e6cf..bf04b46b1 100644 --- a/crossterm_input/src/input/input.rs +++ b/crossterm_input/src/input/input.rs @@ -43,9 +43,8 @@ impl TerminalInput { /// Not sure what 'raw mode' is, checkout the 'crossterm_screen' crate. /// /// # Example - /// ```rust - /// let input = crossterm_input::input(); - /// match input.read_line() { + /// ```ignore + /// match input().read_line() { /// Ok(s) => println!("string typed: {}", s), /// Err(e) => println!("error: {}", e), /// } @@ -60,10 +59,8 @@ impl TerminalInput { /// Read one character from the user input /// - /// ```rust - /// let input = crossterm_input::input(); - /// - /// match input.read_char() { + /// ```ignore + /// match input().read_char() { /// Ok(c) => println!("character pressed: {}", c), /// Err(e) => println!("error: {}", e), /// } From d3add848bab7052bddf35a106519e0ce18df6e7d Mon Sep 17 00:00:00 2001 From: Robert Vojta Date: Sat, 14 Sep 2019 00:02:43 +0200 Subject: [PATCH 4/4] Use temp variable Signed-off-by: Robert Vojta --- crossterm_input/src/input/input.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/crossterm_input/src/input/input.rs b/crossterm_input/src/input/input.rs index bf04b46b1..93e66549b 100644 --- a/crossterm_input/src/input/input.rs +++ b/crossterm_input/src/input/input.rs @@ -44,7 +44,8 @@ impl TerminalInput { /// /// # Example /// ```ignore - /// match input().read_line() { + /// let in = input(); + /// match in.read_line() { /// Ok(s) => println!("string typed: {}", s), /// Err(e) => println!("error: {}", e), /// } @@ -60,7 +61,8 @@ impl TerminalInput { /// Read one character from the user input /// /// ```ignore - /// match input().read_char() { + /// let in = input(); + /// match in.read_char() { /// Ok(c) => println!("character pressed: {}", c), /// Err(e) => println!("error: {}", e), /// }