Skip to content

Commit c9af553

Browse files
committed
Fix clippy errors
1 parent 51e88f4 commit c9af553

File tree

3 files changed

+15
-21
lines changed

3 files changed

+15
-21
lines changed

src/db.rs

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,8 @@ impl Db {
156156
Ok(job)
157157
})
158158
.await
159-
.map(|job| {
160-
self.increment_queued_job_metric(&job);
161-
job
159+
.inspect(|job| {
160+
self.increment_queued_job_metric(job);
162161
})
163162
}
164163

@@ -258,9 +257,8 @@ impl Db {
258257
Ok(job)
259258
})
260259
.await
261-
.map(|job| {
262-
self.increment_queued_job_metric(&job);
263-
job
260+
.inspect(|job| {
261+
self.increment_queued_job_metric(job);
264262
})
265263
}
266264

@@ -289,9 +287,8 @@ impl Db {
289287
Ok(job)
290288
})
291289
.await
292-
.map(|job| {
293-
self.increment_queued_job_metric(&job);
294-
job
290+
.inspect(|job| {
291+
self.increment_queued_job_metric(job);
295292
})
296293
}
297294

@@ -308,9 +305,8 @@ impl Db {
308305
.map_err(ApiError::from)
309306
})
310307
.await
311-
.map(|job| {
312-
self.increment_queued_job_metric(&job);
313-
job
308+
.inspect(|job| {
309+
self.increment_queued_job_metric(job);
314310
})
315311
}
316312

src/jobs/job_executor.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,12 @@ impl Actor for JobExecutor {
3535
type Context = SyncContext<Self>;
3636
}
3737

38+
type QueuedJobInstance = (i16, Option<String>, Box<dyn JobInstance>);
39+
3840
fn pick_next_job(
3941
executor: &mut JobExecutor,
4042
conn: &mut PgConnection,
41-
) -> Result<(i16, Option<String>, Box<dyn JobInstance>), DieselError> {
43+
) -> Result<QueuedJobInstance, DieselError> {
4244
use diesel::dsl::exists;
4345
use diesel::dsl::not;
4446
use diesel::dsl::now;
@@ -63,8 +65,7 @@ fn pick_next_job(
6365
),
6466
)));
6567

66-
let mut new_instances: Vec<(i16, Option<String>, Box<dyn JobInstance>)> = match for_repo
67-
{
68+
let mut new_instances: Vec<QueuedJobInstance> = match for_repo {
6869
None => jobs::table
6970
.order(jobs::id)
7071
.filter(ready_job_filter.and(jobs::repo.is_null()))

src/metrics.rs

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,9 @@ impl Metrics {
3737
let jobs_queued = Family::<JobLabels, Gauge>::default();
3838
let job_duration_seconds =
3939
Family::<JobResultLabels, Histogram>::new_with_constructor(|| {
40-
Histogram::new(
41-
[
42-
1.0, 5.0, 15.0, 30.0, 60.0, 120.0, 300.0, 600.0, 1800.0, 3600.0,
43-
]
44-
.into_iter(),
45-
)
40+
Histogram::new([
41+
1.0, 5.0, 15.0, 30.0, 60.0, 120.0, 300.0, 600.0, 1800.0, 3600.0,
42+
])
4643
});
4744

4845
flat_manager_registry.register(

0 commit comments

Comments
 (0)