diff --git a/ptyd/src/controlterm.rs b/ptyd/src/controlterm.rs index 10c66edda4..f1f6fc42f8 100644 --- a/ptyd/src/controlterm.rs +++ b/ptyd/src/controlterm.rs @@ -18,8 +18,8 @@ pub struct PtyControlTerm { impl PtyControlTerm { pub fn new(pty: Rc>, flags: usize) -> Self { PtyControlTerm { - pty: pty, - flags: flags, + pty, + flags, notified_read: false, notified_write: false, } diff --git a/ptyd/src/main.rs b/ptyd/src/main.rs index d82199b5cf..323e2dd97a 100644 --- a/ptyd/src/main.rs +++ b/ptyd/src/main.rs @@ -59,7 +59,7 @@ fn daemon(daemon: daemon::Daemon) -> ! { let mut timeout_count = 0u64; scan_requests(&mut handler, &scheme).expect("pty: could not scan requests"); - issue_events(&socket, &mut *scheme.borrow_mut()); + issue_events(&socket, &mut scheme.borrow_mut()); for event_res in event_queue { let event = event_res.expect("pty: failed to read from event queue"); @@ -87,7 +87,7 @@ fn daemon(daemon: daemon::Daemon) -> ! { } } - issue_events(&socket, &mut *scheme.borrow_mut()); + issue_events(&socket, &mut scheme.borrow_mut()); } std::process::exit(0); diff --git a/ptyd/src/pgrp.rs b/ptyd/src/pgrp.rs index 5137bf2b14..68a9be5abd 100644 --- a/ptyd/src/pgrp.rs +++ b/ptyd/src/pgrp.rs @@ -15,10 +15,7 @@ pub struct PtyPgrp { impl PtyPgrp { pub fn new(pty: Weak>, flags: usize) -> Self { - PtyPgrp { - pty: pty, - flags: flags, - } + PtyPgrp { pty, flags } } } diff --git a/ptyd/src/pty.rs b/ptyd/src/pty.rs index 1e95a9bc8a..82c050d316 100644 --- a/ptyd/src/pty.rs +++ b/ptyd/src/pty.rs @@ -2,7 +2,6 @@ use std::collections::VecDeque; use std::io::{Cursor, Write}; use redox_termios::*; -use syscall; use syscall::error::Result; pub struct Pty { @@ -20,7 +19,7 @@ pub struct Pty { impl Pty { pub fn new(id: usize) -> Self { Pty { - id: id, + id, pgrp: 0, termios: Termios::default(), winsize: Winsize::default(), @@ -273,20 +272,18 @@ impl Pty { if !self.cooked.is_empty() { self.mosi.push_back(self.cooked.clone()); self.cooked.clear(); - } else { - if let Some(timeout_character) = self.timeout_character { - if self.timeout_count >= timeout_character.wrapping_add(vtime) { - self.timeout_character = None; + } else if let Some(timeout_character) = self.timeout_character { + if self.timeout_count >= timeout_character.wrapping_add(vtime) { + self.timeout_character = None; - if self.mosi.is_empty() { - self.mosi.push_back(self.cooked.clone()); - self.cooked.clear(); - } + if self.mosi.is_empty() { + self.mosi.push_back(self.cooked.clone()); + self.cooked.clear(); } - } else { - // Start timer if not already started - self.timeout_character = Some(self.timeout_count); } + } else { + // Start timer if not already started + self.timeout_character = Some(self.timeout_count); } } else { // Return when min bytes are received or the timer expires diff --git a/ptyd/src/subterm.rs b/ptyd/src/subterm.rs index 4bf521d8ed..beda848fa3 100644 --- a/ptyd/src/subterm.rs +++ b/ptyd/src/subterm.rs @@ -18,8 +18,8 @@ pub struct PtySubTerm { impl PtySubTerm { pub fn new(pty: Weak>, flags: usize) -> Self { PtySubTerm { - pty: pty, - flags: flags, + pty, + flags, notified_read: false, notified_write: false, } diff --git a/ptyd/src/termios.rs b/ptyd/src/termios.rs index 5f28f38b8b..2d8a682e2e 100644 --- a/ptyd/src/termios.rs +++ b/ptyd/src/termios.rs @@ -16,10 +16,7 @@ pub struct PtyTermios { impl PtyTermios { pub fn new(pty: Weak>, flags: usize) -> Self { - PtyTermios { - pty: pty, - flags: flags, - } + PtyTermios { pty, flags } } } diff --git a/ptyd/src/winsize.rs b/ptyd/src/winsize.rs index a4b807eb79..a7e247731a 100644 --- a/ptyd/src/winsize.rs +++ b/ptyd/src/winsize.rs @@ -16,10 +16,7 @@ pub struct PtyWinsize { impl PtyWinsize { pub fn new(pty: Weak>, flags: usize) -> Self { - PtyWinsize { - pty: pty, - flags: flags, - } + PtyWinsize { pty, flags } } }