Skip to content

Commit

Permalink
style: remove un-needed trait bound from impls
Browse files Browse the repository at this point in the history
minor cleanup:

Only one impl on JobQueue actually needs the Ord trait bound.

This removes it from the JobQueue struct and the other impls.
  • Loading branch information
dan-da committed Nov 13, 2024
1 parent aa009d0 commit 3884b0a
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/job_queue/queue.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@ impl JobHandle {
}

/// messages that can be sent to job-queue inner task.
enum JobQueueMsg<P: Ord> {
enum JobQueueMsg<P> {
AddJob(AddJobMsg<P>),
Stop,
}

/// represents a msg to add a job to the queue.
struct AddJobMsg<P: Ord> {
struct AddJobMsg<P> {
job: Box<dyn Job>,
result_tx: JobResultSender,
cancel_tx: JobCancelSender,
Expand All @@ -78,21 +78,21 @@ struct AddJobMsg<P: Ord> {
}

/// implements a job queue that sends result of each job to a listener.
pub struct JobQueue<P: Ord> {
pub struct JobQueue<P> {
tx: mpsc::UnboundedSender<JobQueueMsg<P>>,
tracker: TaskTracker,
refs: Arc<()>,
}

impl<P: Ord> std::fmt::Debug for JobQueue<P> {
impl<P> std::fmt::Debug for JobQueue<P> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
f.debug_struct("JobQueue")
.field("tx", &"mpsc::Sender")
.finish()
}
}

impl<P: Ord> Clone for JobQueue<P> {
impl<P> Clone for JobQueue<P> {
fn clone(&self) -> Self {
Self {
tx: self.tx.clone(),
Expand All @@ -102,7 +102,7 @@ impl<P: Ord> Clone for JobQueue<P> {
}
}

impl<P: Ord> Drop for JobQueue<P> {
impl<P> Drop for JobQueue<P> {
// since JobQueue has impl Clone there can be other instances.
// we must only send the Stop message when dropping the last instance.
// if upgrade of a Weak Arc fails then we are the last one.
Expand Down

0 comments on commit 3884b0a

Please sign in to comment.