fix(builders): prefer unwrap_or to pattern matching

This commit is contained in:
Gabriele Musco 2024-05-13 14:35:53 +02:00
parent b2ea86211e
commit c140d191c9
No known key found for this signature in database
GPG key ID: 1068D795C80E51DE
6 changed files with 72 additions and 48 deletions

View file

@ -13,15 +13,21 @@ pub fn get_build_basalt_jobs(profile: &Profile, clean_build: bool) -> VecDeque<W
let mut jobs = VecDeque::<WorkerJob>::new();
let git = Git {
repo: match profile.features.basalt.repo.as_ref() {
Some(r) => r.clone(),
None => "https://gitlab.freedesktop.org/mateosss/basalt.git".into(),
},
repo: profile
.features
.basalt
.repo
.as_ref()
.unwrap_or(&"https://gitlab.freedesktop.org/mateosss/basalt.git".into())
.clone(),
dir: profile.features.basalt.path.as_ref().unwrap().clone(),
branch: match profile.features.basalt.branch.as_ref() {
Some(r) => r.clone(),
None => "main".into(),
},
branch: profile
.features
.basalt
.branch
.as_ref()
.unwrap_or(&"main".into())
.clone(),
};
jobs.extend(git.get_pre_build_jobs(profile.pull_on_build));

View file

@ -13,15 +13,21 @@ pub fn get_build_libsurvive_jobs(profile: &Profile, clean_build: bool) -> VecDeq
let mut jobs = VecDeque::<WorkerJob>::new();
let git = Git {
repo: match profile.features.libsurvive.repo.as_ref() {
Some(r) => r.clone(),
None => "https://github.com/cntools/libsurvive".into(),
},
repo: profile
.features
.libsurvive
.repo
.as_ref()
.unwrap_or(&"https://github.com/cntools/libsurvive".into())
.clone(),
dir: profile.features.libsurvive.path.as_ref().unwrap().clone(),
branch: match profile.features.libsurvive.branch.as_ref() {
Some(r) => r.clone(),
None => "master".into(),
},
branch: profile
.features
.libsurvive
.branch
.as_ref()
.unwrap_or(&"master".into())
.clone(),
};
jobs.extend(git.get_pre_build_jobs(profile.pull_on_build));

View file

@ -13,15 +13,17 @@ pub fn get_build_monado_jobs(profile: &Profile, clean_build: bool) -> VecDeque<W
let mut jobs = VecDeque::<WorkerJob>::new();
let git = Git {
repo: match profile.xrservice_repo.as_ref() {
Some(r) => r.clone(),
None => "https://gitlab.freedesktop.org/monado/monado".into(),
},
repo: profile
.xrservice_repo
.as_ref()
.unwrap_or(&"https://gitlab.freedesktop.org/monado/monado".into())
.clone(),
dir: profile.xrservice_path.clone(),
branch: match profile.xrservice_branch.as_ref() {
Some(r) => r.clone(),
None => "main".into(),
},
branch: profile
.xrservice_branch
.as_ref()
.unwrap_or(&"main".into())
.clone(),
};
jobs.extend(git.get_pre_build_jobs(profile.pull_on_build));

View file

@ -13,15 +13,17 @@ pub fn get_build_opencomposite_jobs(profile: &Profile, clean_build: bool) -> Vec
let mut jobs = VecDeque::<WorkerJob>::new();
let git = Git {
repo: match profile.opencomposite_repo.as_ref() {
Some(r) => r.clone(),
None => "https://gitlab.com/znixian/OpenOVR.git".into(),
},
repo: profile
.opencomposite_repo
.as_ref()
.unwrap_or(&"https://gitlab.com/znixian/OpenOVR.git".into())
.clone(),
dir: profile.opencomposite_path.clone(),
branch: match profile.opencomposite_branch.as_ref() {
Some(r) => r.clone(),
None => "openxr".into(),
},
branch: profile
.opencomposite_branch
.as_ref()
.unwrap_or(&"openxr".into())
.clone(),
};
jobs.extend(git.get_pre_build_jobs(profile.pull_on_build));

View file

@ -13,15 +13,21 @@ pub fn get_build_openhmd_jobs(profile: &Profile, clean_build: bool) -> VecDeque<
let mut jobs = VecDeque::<WorkerJob>::new();
let git = Git {
repo: match profile.features.openhmd.repo.as_ref() {
Some(r) => r.clone(),
None => "https://github.com/OpenHMD/OpenHMD".into(),
},
repo: profile
.features
.openhmd
.repo
.as_ref()
.unwrap_or(&"https://github.com/OpenHMD/OpenHMD".into())
.clone(),
dir: profile.features.openhmd.path.as_ref().unwrap().clone(),
branch: match profile.features.openhmd.branch.as_ref() {
Some(r) => r.clone(),
None => "master".into(),
},
branch: profile
.features
.openhmd
.branch
.as_ref()
.unwrap_or(&"master".into())
.clone(),
};
jobs.extend(git.get_pre_build_jobs(profile.pull_on_build));

View file

@ -13,15 +13,17 @@ pub fn get_build_wivrn_jobs(profile: &Profile, clean_build: bool) -> VecDeque<Wo
let mut jobs = VecDeque::<WorkerJob>::new();
let git = Git {
repo: match profile.xrservice_repo.as_ref() {
Some(r) => r.clone(),
None => "https://github.com/Meumeu/WiVRn".into(),
},
repo: profile
.xrservice_repo
.as_ref()
.unwrap_or(&"https://github.com/Meumeu/WiVRn".into())
.clone(),
dir: profile.xrservice_path.clone(),
branch: match profile.xrservice_branch.as_ref() {
Some(r) => r.clone(),
None => "master".into(),
},
branch: profile
.xrservice_branch
.as_ref()
.unwrap_or(&"master".into())
.clone(),
};
jobs.extend(git.get_pre_build_jobs(profile.pull_on_build));