summaryrefslogtreecommitdiff
path: root/src/cli.rs
diff options
context:
space:
mode:
authorYuval Adam <_@yuv.al>2018-07-09 16:43:48 +0300
committerYuval Adam <_@yuv.al>2018-07-09 16:43:48 +0300
commit38760603893b52055af7bfa8e32b8578a0da7455 (patch)
tree327588e56748c075491dd195e05e717b55176488 /src/cli.rs
parent7e72a433856eb8338148e2c49497adfa1711193b (diff)
Cleanup after running clippy lint
Diffstat (limited to 'src/cli.rs')
-rw-r--r--src/cli.rs21
1 files changed, 11 insertions, 10 deletions
diff --git a/src/cli.rs b/src/cli.rs
index f0d85c0..2251e39 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -6,7 +6,6 @@ use self::termios::{Termios, TCSANOW, ECHO, ICANON, tcsetattr};
pub struct Controller {
termios: Termios,
- new_termios: Termios,
stdin: i32,
stdout: Stdout,
reader: Stdin,
@@ -17,19 +16,21 @@ impl Controller {
pub fn init() -> Controller {
let stdin = 0;
let termios = Termios::from_fd(stdin).unwrap();
- let mut new_termios = termios.clone(); // make a mutable copy of termios that we will modify
- new_termios.c_lflag &= !(ICANON | ECHO); // no echo and canonical mode
- tcsetattr(stdin, TCSANOW, &mut new_termios).unwrap();
+
+ // make a mutable copy of termios, and drop echo and canonical mode
+ let mut new_termios = termios;
+ new_termios.c_lflag &= !(ICANON | ECHO);
+
+ tcsetattr(stdin, TCSANOW, &new_termios).unwrap();
let stdout = io::stdout();
let reader = io::stdin();
let buffer = [0; 1];
Controller {
- termios: termios,
- new_termios: new_termios,
- stdin: stdin,
- stdout: stdout,
- reader: reader,
- buffer: buffer
+ termios,
+ stdin,
+ stdout,
+ reader,
+ buffer
}
}