diff options
author | Christian Duerr <chrisduerr@users.noreply.github.com> | 2018-01-06 01:42:55 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-06 01:42:55 +0000 |
commit | 2920cbe7103f03a45080bfb7610bd7f481f36361 (patch) | |
tree | 4839deca8a54d8e2546d124eb26178fd1eac4d4a /src/tty.rs | |
parent | 650b5a0cbaccc6de2b53240372c2be79739d5d12 (diff) | |
download | alacritty-2920cbe7103f03a45080bfb7610bd7f481f36361.tar.gz alacritty-2920cbe7103f03a45080bfb7610bd7f481f36361.zip |
Add clippy check to travis
This commit adds clippy as a required step of the build process. To make
this possible, all existing clippy issues have been resolved.
Diffstat (limited to 'src/tty.rs')
-rw-r--r-- | src/tty.rs | 17 |
1 files changed, 10 insertions, 7 deletions
@@ -70,8 +70,8 @@ fn openpty(rows: u8, cols: u8) -> (c_int, c_int) { let mut slave: c_int = 0; let win = winsize { - ws_row: rows as libc::c_ushort, - ws_col: cols as libc::c_ushort, + ws_row: libc::c_ushort::from(rows), + ws_col: libc::c_ushort::from(cols), ws_xpixel: 0, ws_ypixel: 0, }; @@ -93,8 +93,8 @@ fn openpty(rows: u8, cols: u8) -> (c_int, c_int) { let mut slave: c_int = 0; let mut win = winsize { - ws_row: rows as libc::c_ushort, - ws_col: cols as libc::c_ushort, + ws_row: libc::c_ushort::from(rows), + ws_col: libc::c_ushort::from(cols), ws_xpixel: 0, ws_ypixel: 0, }; @@ -113,7 +113,10 @@ fn openpty(rows: u8, cols: u8) -> (c_int, c_int) { /// Really only needed on BSD, but should be fine elsewhere fn set_controlling_terminal(fd: c_int) { let res = unsafe { - libc::ioctl(fd, TIOCSCTTY as _, 0) + // Cross platform issue because on linux this is u64 as u64 (does nothing) + // But on macos this is u32 as u64, asking for u64::from(u32) + #[cfg_attr(feature = "clippy", allow(cast_lossless))] + libc::ioctl(fd, TIOCSCTTY as u64, 0) }; if res < 0 { @@ -174,7 +177,7 @@ fn get_pw_entry(buf: &mut [i8; 1024]) -> Passwd { } /// Create a new tty and return a handle to interact with it. -pub fn new<T: ToWinsize>(config: &Config, options: &Options, size: T, window_id: Option<usize>) -> Pty { +pub fn new<T: ToWinsize>(config: &Config, options: &Options, size: &T, window_id: Option<usize>) -> Pty { let win = size.to_winsize(); let mut buf = [0; 1024]; let pw = get_pw_entry(&mut buf); @@ -262,7 +265,7 @@ pub fn new<T: ToWinsize>(config: &Config, options: &Options, size: T, window_id: } let pty = Pty { fd: master }; - pty.resize(&size); + pty.resize(size); pty }, Err(err) => { |