Apply clippy recommendations
This commit is contained in:
parent
6ec02d38ab
commit
05e66784ce
10
src/error.rs
10
src/error.rs
|
@ -28,14 +28,8 @@ impl From<globset::Error> for Error {
|
|||
impl From<io::Error> for Error {
|
||||
fn from(err: io::Error) -> Self {
|
||||
Self::Io(match err.raw_os_error() {
|
||||
Some(os_err) => match os_err {
|
||||
7 => {
|
||||
let msg = "There are so many changed files that the environment variables of the command have been overrun. Try running with --no-meta or --no-environment.";
|
||||
io::Error::new(io::ErrorKind::Other, msg)
|
||||
}
|
||||
_ => err,
|
||||
},
|
||||
None => err,
|
||||
Some(7) => io::Error::new(io::ErrorKind::Other, "There are so many changed files that the environment variables of the command have been overrun. Try running with --no-meta or --no-environment."),
|
||||
_ => err,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
@ -97,7 +97,7 @@ impl Gitignore {
|
|||
.iter()
|
||||
.filter(|f| path.starts_with(&f.root))
|
||||
.collect();
|
||||
applicable_files.sort_by(|l, r| l.root_len().cmp(&r.root_len()));
|
||||
applicable_files.sort_by_key(|f| f.root_len());
|
||||
|
||||
// TODO: add user gitignores
|
||||
|
||||
|
|
|
@ -103,7 +103,7 @@ impl Ignore {
|
|||
.iter()
|
||||
.filter(|f| path.starts_with(&f.root))
|
||||
.collect();
|
||||
applicable_files.sort_by(|l, r| l.root_len().cmp(&r.root_len()));
|
||||
applicable_files.sort_by_key(|f| f.root_len());
|
||||
|
||||
// TODO: add user ignores
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
//!
|
||||
//! [watchexec]: https://github.com/watchexec/watchexec
|
||||
|
||||
#![warn(clippy::option_unwrap_used, clippy::result_unwrap_used)]
|
||||
#![warn(clippy::unwrap_used)]
|
||||
|
||||
#[macro_use]
|
||||
extern crate derive_builder;
|
||||
|
|
|
@ -118,15 +118,13 @@ mod imp {
|
|||
unsafe {
|
||||
command.pre_exec(|| setsid().map_err(from_nix_error).map(|_| ()));
|
||||
}
|
||||
command.spawn().and_then(|p| {
|
||||
Ok(Self {
|
||||
pgid: p
|
||||
.id()
|
||||
.try_into()
|
||||
.expect("u32 -> i32 failed in process::new"),
|
||||
lock: Mutex::new(false),
|
||||
cvar: Condvar::new(),
|
||||
})
|
||||
command.spawn().map(|p| Self {
|
||||
pgid: p
|
||||
.id()
|
||||
.try_into()
|
||||
.expect("u32 -> i32 failed in process::new"),
|
||||
lock: Mutex::new(false),
|
||||
cvar: Condvar::new(),
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
@ -56,10 +56,6 @@ impl Watcher {
|
|||
}
|
||||
|
||||
pub fn is_polling(&self) -> bool {
|
||||
if let WatcherImpl::Poll(_) = self.watcher_impl {
|
||||
true
|
||||
} else {
|
||||
false
|
||||
}
|
||||
matches!(self.watcher_impl, WatcherImpl::Poll(_))
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue