Fix const Option::unwrap_or()

Fixes #57
This commit is contained in:
Hannes Körber
2023-05-04 11:27:47 +02:00
parent 60a777276f
commit f2fa3411d8
3 changed files with 8 additions and 4 deletions

View File

@@ -1,5 +1,4 @@
#![feature(io_error_more)]
#![feature(const_option_ext)]
#![forbid(unsafe_code)]
use std::path::Path;

View File

@@ -9,8 +9,10 @@ use super::Project;
use super::Provider;
const ACCEPT_HEADER_JSON: &str = "application/vnd.github.v3+json";
const GITHUB_API_BASEURL: &str =
option_env!("GITHUB_API_BASEURL").unwrap_or("https://api.github.com");
const GITHUB_API_BASEURL: &str = match option_env!("GITHUB_API_BASEURL") {
Some(url) => url,
None => "https://api.github.com",
};
#[derive(Deserialize)]
pub struct GithubProject {

View File

@@ -9,7 +9,10 @@ use super::Project;
use super::Provider;
const ACCEPT_HEADER_JSON: &str = "application/json";
const GITLAB_API_BASEURL: &str = option_env!("GITLAB_API_BASEURL").unwrap_or("https://gitlab.com");
const GITLAB_API_BASEURL: &str = match option_env!("GITLAB_API_BASEURL") {
Some(url) => url,
None => "https://gitlab.com",
};
#[derive(Deserialize)]
#[serde(rename_all = "lowercase")]