refactor: remove unused/dead code, apply allowances to the rest

This commit is contained in:
2025-09-14 01:57:30 -05:00
parent 3dca896a35
commit 8384f418c8
10 changed files with 19 additions and 63 deletions
+2 -10
View File
@@ -12,7 +12,6 @@ use std::fmt;
pub enum JobParseError {
InvalidJson(serde_json::Error),
UnsupportedTargetType(TargetType),
MissingRequiredField(String),
}
impl fmt::Display for JobParseError {
@@ -22,9 +21,6 @@ impl fmt::Display for JobParseError {
JobParseError::UnsupportedTargetType(t) => {
write!(f, "Unsupported target type: {:?}", t)
}
JobParseError::MissingRequiredField(field) => {
write!(f, "Missing required field: {}", field)
}
}
}
}
@@ -67,6 +63,7 @@ impl std::error::Error for JobError {
#[async_trait::async_trait]
pub trait Job: Send + Sync {
/// The target type this job handles
#[allow(dead_code)]
fn target_type(&self) -> TargetType;
/// Process the job with the given API client and database pool
@@ -99,14 +96,9 @@ impl JobType {
}
/// Convert to a Job trait object
pub fn as_job(self) -> Box<dyn Job> {
pub fn boxed(self) -> Box<dyn Job> {
match self {
JobType::Subject(job) => Box::new(job),
}
}
}
/// Helper function to create a subject job
pub fn create_subject_job(subject: String) -> JobType {
JobType::Subject(subject::SubjectJob::new(subject))
}
+1 -1
View File
@@ -135,7 +135,7 @@ impl Worker {
.map_err(|e| JobError::Unrecoverable(anyhow::anyhow!(e)))?; // Parse errors are unrecoverable
// Get the job implementation
let job_impl = job_type.as_job();
let job_impl = job_type.boxed();
debug!(
worker_id = self.id,