Skip to content

Commit

Permalink
Fix const Option::unwrap_or()
Browse files Browse the repository at this point in the history
Fixes #57
  • Loading branch information
Hannes Körber committed May 4, 2023
1 parent 60a7772 commit f2fa341
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 0 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![feature(io_error_more)]
#![feature(const_option_ext)]
#![forbid(unsafe_code)]

use std::path::Path;
Expand Down
6 changes: 4 additions & 2 deletions src/provider/github.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 4 additions & 1 deletion src/provider/gitlab.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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")]
Expand Down

0 comments on commit f2fa341

Please sign in to comment.