From 8b921e9e15fe51ba977bc16041807d555e529d00 Mon Sep 17 00:00:00 2001 From: Xiang Gao Date: Thu, 20 Jun 2024 08:17:05 -0700 Subject: [PATCH] Use enum directly for ScheduleType Summary: EZ Differential Revision: D58769679 fbshipit-source-id: e570c2a0af1ad8be40df09d99a2d38c689ee8546 --- td_util/src/schedules.rs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/td_util/src/schedules.rs b/td_util/src/schedules.rs index fe18de3..39a1391 100644 --- a/td_util/src/schedules.rs +++ b/td_util/src/schedules.rs @@ -20,8 +20,13 @@ use serde::Deserialize; use serde::Serialize; lazy_static! { - static ref CHANGESET_SCHEDULE_TYPES: HashSet<&'static str> = - HashSet::from(["diff", "landcastle", "master", "postcommit", "relbranch"]); + static ref CHANGESET_SCHEDULE_TYPES: HashSet = HashSet::from([ + ScheduleType::Diff, + ScheduleType::Landcastle, + ScheduleType::Master, + ScheduleType::Postcommit, + ScheduleType::Relbranch, + ]); } #[derive( @@ -52,13 +57,14 @@ pub enum ScheduleType { Greenwarden, Disabled, Master, + Relbranch, } impl ScheduleType { /// Mobile build TDs use schedule_type to decide whether we need to run build for changeset (e.g. diff and landcastle) /// See UTD implementation: pub fn is_changeset_schedule_type(&self) -> bool { - CHANGESET_SCHEDULE_TYPES.contains(self.to_string().as_str()) + CHANGESET_SCHEDULE_TYPES.contains(self) } }