Skip to content

Commit

Permalink
Move clippy tests to stable
Browse files Browse the repository at this point in the history
The clippy tests had to be run on nightly previously since it wasn't
available with the stable compiler yet, however this had the potential
to fail a lot since not all nightly builds offer clippy.

Since clippy is now available for stable rust, moving clippy to a stable
build should make sure that the failure rate of the CI job is cut down
to a minimum.

This fixes alacritty#2007.
  • Loading branch information
chrisduerr authored Jan 23, 2019
1 parent 3be51e6 commit 430b89c
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 14 deletions.
13 changes: 13 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ os:

rust:
- stable
- beta
- nightly

matrix:
Expand All @@ -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

Expand Down
4 changes: 2 additions & 2 deletions ci/install.sh
Original file line number Diff line number Diff line change
@@ -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
7 changes: 4 additions & 3 deletions ci/script.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion src/config/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ macro_rules! bindings {
mode: _mode,
notmode: _notmode,
action: $action,
..Default::default()
});
)*

Expand Down
2 changes: 1 addition & 1 deletion src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion src/tty/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
12 changes: 6 additions & 6 deletions src/tty/windows/winpty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}

Expand Down

0 comments on commit 430b89c

Please sign in to comment.