Skip to content

Commit 00603e2

Browse files
committed
Use string constants
1 parent d0ed82f commit 00603e2

File tree

1 file changed

+18
-13
lines changed

1 file changed

+18
-13
lines changed

database/src/lib.rs

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,13 +1027,18 @@ pub enum BenchmarkJobStatus {
10271027
Failure,
10281028
}
10291029

1030+
const BENCHMARK_JOB_STATUS_QUEUED_STR: &str = "queued";
1031+
const BENCHMARK_JOB_STATUS_IN_PROGRESS_STR: &str = "in_progress";
1032+
const BENCHMARK_JOB_STATUS_SUCCESS_STR: &str = "success";
1033+
const BENCHMARK_JOB_STATUS_FAILURE_STR: &str = "failure";
1034+
10301035
impl BenchmarkJobStatus {
10311036
pub fn as_str(&self) -> &str {
10321037
match self {
1033-
BenchmarkJobStatus::Queued => "queued",
1034-
BenchmarkJobStatus::InProgress => "in_progress",
1035-
BenchmarkJobStatus::Success => "success",
1036-
BenchmarkJobStatus::Failure => "failure",
1038+
BenchmarkJobStatus::Queued => BENCHMARK_JOB_STATUS_QUEUED_STR,
1039+
BenchmarkJobStatus::InProgress => BENCHMARK_JOB_STATUS_IN_PROGRESS_STR,
1040+
BenchmarkJobStatus::Success => BENCHMARK_JOB_STATUS_SUCCESS_STR,
1041+
BenchmarkJobStatus::Failure => BENCHMARK_JOB_STATUS_FAILURE_STR,
10371042
}
10381043
}
10391044
}
@@ -1046,15 +1051,15 @@ impl fmt::Display for BenchmarkJobStatus {
10461051

10471052
#[derive(Debug, Clone, PartialEq)]
10481053
pub struct BenchmarkJob {
1049-
pub target: Target,
1050-
pub backend: CodegenBackend,
1051-
pub benchmark_set: u32,
1052-
pub collector_id: String,
1053-
pub created_at: Option<DateTime<Utc>>,
1054-
pub started_at: Option<DateTime<Utc>>,
1055-
pub completed_at: Option<DateTime<Utc>>,
1056-
pub status: BenchmarkJobStatus,
1057-
pub retry: u32,
1054+
target: Target,
1055+
backend: CodegenBackend,
1056+
benchmark_set: u32,
1057+
collector_id: String,
1058+
created_at: Option<DateTime<Utc>>,
1059+
started_at: Option<DateTime<Utc>>,
1060+
completed_at: Option<DateTime<Utc>>,
1061+
status: BenchmarkJobStatus,
1062+
retry: u32,
10581063
}
10591064

10601065
impl BenchmarkJob {

0 commit comments

Comments
 (0)