diff --git a/.travis.yml b/.travis.yml index 41f34e8c..1134792e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -13,6 +13,7 @@ os: rust: - stable + - beta - nightly matrix: @@ -22,6 +23,18 @@ matrix: os: linux rust: stable env: ARCH=i386 + - name: "Clippy Linux" + os: linux + env: CLIPPY=true + rust: stable + - name: "Clippy OSX" + os: osx + env: CLIPPY=true + rust: stable + - name: "Clippy Windows" + os: windows + env: CLIPPY=true + rust: stable allow_failures: - rust: nightly diff --git a/ci/install.sh b/ci/install.sh index 9e8c2e6d..af4bb776 100755 --- a/ci/install.sh +++ b/ci/install.sh @@ -1,6 +1,6 @@ #!/bin/bash # Add clippy for linting with nightly builds -if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then - rustup component add clippy-preview +if [ "$CLIPPY" == "true" ]; then + rustup component add clippy fi diff --git a/ci/script.sh b/ci/script.sh index 4dfc4323..c17bbbd2 100755 --- a/ci/script.sh +++ b/ci/script.sh @@ -3,9 +3,10 @@ # Check if any command failed error=false -# Run clippy on nightly builds -if [ "$TRAVIS_RUST_VERSION" == "nightly" ]; then - cargo clippy --all-features --all-targets || error=true +# Run clippy checks +if [ "$CLIPPY" == "true" ]; then + cargo clippy --all-targets + exit fi # Run test in release mode if a tag is present, to produce an optimized binary diff --git a/src/config/bindings.rs b/src/config/bindings.rs index 701fadc1..9bbd496c 100644 --- a/src/config/bindings.rs +++ b/src/config/bindings.rs @@ -47,7 +47,6 @@ macro_rules! bindings { mode: _mode, notmode: _notmode, action: $action, - ..Default::default() }); )* diff --git a/src/logging.rs b/src/logging.rs index 893a39a2..1f51d2b2 100644 --- a/src/logging.rs +++ b/src/logging.rs @@ -137,7 +137,7 @@ impl log::Log for Logger { record.file().unwrap_or("?"), record.line() .map(|l| l.to_string()) - .unwrap_or("?".to_string()), + .unwrap_or_else(|| "?".into()), record.args()) } else { format!("[{}] [{}] {}\n", diff --git a/src/tty/windows/mod.rs b/src/tty/windows/mod.rs index fff40cb3..ae228bf3 100644 --- a/src/tty/windows/mod.rs +++ b/src/tty/windows/mod.rs @@ -208,7 +208,7 @@ impl Write for EventedWritablePipe { impl<'a> OnResize for PtyHandle<'a> { fn on_resize(&mut self, sizeinfo: &SizeInfo) { match self { - PtyHandle::Winpty(w) => w.winpty_mut().on_resize(sizeinfo), + PtyHandle::Winpty(w) => w.resize(sizeinfo), PtyHandle::Conpty(c) => { let mut handle = c.clone(); handle.on_resize(sizeinfo) diff --git a/src/tty/windows/winpty.rs b/src/tty/windows/winpty.rs index 9daa88d1..26536eee 100644 --- a/src/tty/windows/winpty.rs +++ b/src/tty/windows/winpty.rs @@ -55,14 +55,14 @@ impl<'a> Agent<'a> { /// Get immutable access to Winpty. pub fn winpty(&self) -> &Winpty<'a> { - unsafe {&*self.winpty} + unsafe { &*self.winpty } } - /// Get mutable access to Winpty. - /// Can offer internal mutability like this because Winpty uses - /// a mutex internally. - pub fn winpty_mut(&self) -> &mut Winpty<'a> { - unsafe {&mut *self.winpty} + pub fn resize(&self, size: &SizeInfo) { + // This is safe since Winpty uses a mutex internally. + unsafe { + (&mut *self.winpty).on_resize(size); + } } }