Skip to content

Commit f47168a

Browse files
committed
Use string constants
1 parent b8a93e9 commit f47168a

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
@@ -1065,13 +1065,18 @@ pub enum BenchmarkJobStatus {
10651065
Failure,
10661066
}
10671067

1068+
const BENCHMARK_JOB_STATUS_QUEUED_STR: &str = "queued";
1069+
const BENCHMARK_JOB_STATUS_IN_PROGRESS_STR: &str = "in_progress";
1070+
const BENCHMARK_JOB_STATUS_SUCCESS_STR: &str = "success";
1071+
const BENCHMARK_JOB_STATUS_FAILURE_STR: &str = "failure";
1072+
10681073
impl BenchmarkJobStatus {
10691074
pub fn as_str(&self) -> &str {
10701075
match self {
1071-
BenchmarkJobStatus::Queued => "queued",
1072-
BenchmarkJobStatus::InProgress => "in_progress",
1073-
BenchmarkJobStatus::Success => "success",
1074-
BenchmarkJobStatus::Failure => "failure",
1076+
BenchmarkJobStatus::Queued => BENCHMARK_JOB_STATUS_QUEUED_STR,
1077+
BenchmarkJobStatus::InProgress => BENCHMARK_JOB_STATUS_IN_PROGRESS_STR,
1078+
BenchmarkJobStatus::Success => BENCHMARK_JOB_STATUS_SUCCESS_STR,
1079+
BenchmarkJobStatus::Failure => BENCHMARK_JOB_STATUS_FAILURE_STR,
10751080
}
10761081
}
10771082
}
@@ -1084,15 +1089,15 @@ impl fmt::Display for BenchmarkJobStatus {
10841089

10851090
#[derive(Debug, Clone, PartialEq)]
10861091
pub struct BenchmarkJob {
1087-
pub target: Target,
1088-
pub backend: CodegenBackend,
1089-
pub benchmark_set: u32,
1090-
pub collector_id: String,
1091-
pub created_at: Option<DateTime<Utc>>,
1092-
pub started_at: Option<DateTime<Utc>>,
1093-
pub completed_at: Option<DateTime<Utc>>,
1094-
pub status: BenchmarkJobStatus,
1095-
pub retry: u32,
1092+
target: Target,
1093+
backend: CodegenBackend,
1094+
benchmark_set: u32,
1095+
collector_id: String,
1096+
created_at: Option<DateTime<Utc>>,
1097+
started_at: Option<DateTime<Utc>>,
1098+
completed_at: Option<DateTime<Utc>>,
1099+
status: BenchmarkJobStatus,
1100+
retry: u32,
10961101
}
10971102

10981103
impl BenchmarkJob {

0 commit comments

Comments
 (0)