Skip to content

Commit

Permalink
fix build warning
Browse files Browse the repository at this point in the history
  • Loading branch information
harryfei committed Sep 22, 2019
1 parent 03c1766 commit 579b7bb
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 11 deletions.
12 changes: 6 additions & 6 deletions src/checker.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::fs;
use finder::Checker;
#[cfg(unix)]
use libc;
#[cfg(unix)]
use std::ffi::CString;
use std::fs;
#[cfg(unix)]
use std::os::unix::ffi::OsStrExt;
use std::path::Path;
#[cfg(unix)]
use libc;
use finder::Checker;

pub struct ExecutableChecker;

Expand Down Expand Up @@ -47,7 +47,7 @@ impl Checker for ExistedChecker {
}

pub struct CompositeChecker {
checkers: Vec<Box<Checker>>,
checkers: Vec<Box<dyn Checker>>,
}

impl CompositeChecker {
Expand All @@ -57,7 +57,7 @@ impl CompositeChecker {
}
}

pub fn add_checker(mut self, checker: Box<Checker>) -> CompositeChecker {
pub fn add_checker(mut self, checker: Box<dyn Checker>) -> CompositeChecker {
self.checkers.push(checker);
self
}
Expand Down
12 changes: 8 additions & 4 deletions src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pub struct Error {
#[cfg(feature = "use_failure")]
inner: Context<ErrorKind>,
#[cfg(not(feature = "use_failure"))]
inner: ErrorKind
inner: ErrorKind,
}

// To suppress false positives from cargo-clippy
Expand Down Expand Up @@ -40,7 +40,7 @@ impl Display for ErrorKind {

#[cfg(feature = "use_failure")]
impl Fail for Error {
fn cause(&self) -> Option<&Fail> {
fn cause(&self) -> Option<&dyn Fail> {
self.inner.cause()
}

Expand All @@ -58,9 +58,13 @@ impl Display for Error {
impl Error {
pub fn kind(&self) -> ErrorKind {
#[cfg(feature = "use_failure")]
{ *self.inner.get_context() }
{
*self.inner.get_context()
}
#[cfg(not(feature = "use_failure"))]
{ self.inner }
{
self.inner
}
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/finder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ impl Finder {
binary_name: T,
paths: Option<U>,
cwd: V,
binary_checker: &Checker,
binary_checker: &dyn Checker,
) -> Result<PathBuf>
where
T: AsRef<OsStr>,
Expand Down

0 comments on commit 579b7bb

Please sign in to comment.