Skip to content

Commit 9daaafa

Browse files
committed
Various fixes suggested by Clippy.
1 parent 5585bbe commit 9daaafa

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

src/config.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ impl Config {
102102
"Must allow at least 1 job",
103103
))
104104
}
105-
Ok(x) if x > (std::usize::MAX - 1) / 2 => {
105+
Ok(x) if x > (usize::MAX - 1) / 2 => {
106106
return Err(error_at_span(
107107
&lexer,
108108
span,
109109
&format!(
110110
"Maximum number of jobs is {}",
111-
(std::usize::MAX - 1) / 2
111+
(usize::MAX - 1) / 2
112112
),
113113
))
114114
}

src/jobrunner.rs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ impl JobRunner {
6363
fn new(snare: Arc<Snare>) -> Result<Self, Box<dyn Error>> {
6464
let shell = env::var("SHELL").unwrap_or_else(|_| "/bin/sh".to_owned());
6565
let maxjobs = snare.conf.lock().unwrap().maxjobs;
66-
assert!(maxjobs <= (std::usize::MAX - 1) / 2);
66+
assert!(maxjobs <= (usize::MAX - 1) / 2);
6767
let mut running = Vec::with_capacity(maxjobs);
6868
running.resize_with(maxjobs, || None);
6969
let mut pollfds = Vec::with_capacity(maxjobs * 2 + 1);
@@ -101,10 +101,7 @@ impl JobRunner {
101101
if timeout == -1
102102
|| fby_timeout < Duration::from_millis(timeout.try_into().unwrap_or(0))
103103
{
104-
timeout = fby_timeout
105-
.as_millis()
106-
.try_into()
107-
.unwrap_or(c_int::max_value());
104+
timeout = fby_timeout.as_millis().try_into().unwrap_or(c_int::MAX);
108105
}
109106
}
110107
poll(&mut self.pollfds, timeout).ok();

src/main.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
//! * The `httpserver` listens for incoming hooks, checks that they're valid, and adds them to a
33
//! `Queue`.
44
//! * The `jobrunner` pops elements from the `Queue` and runs them in parallel.
5+
//!
56
//! These two components run as two different threads: the `httpserver` writes a solitary byte to
67
//! an "event pipe" to wake up the `jobrunner` when the queue has new elements. We also wake up the
78
//! `jobrunner` on SIGHUP and SIGCHLD.
89
10+
#![allow(clippy::too_many_arguments)]
911
#![allow(clippy::type_complexity)]
1012

1113
mod config;

0 commit comments

Comments
 (0)