Skip to content

Commit f2fa341

Browse files
author
Hannes Körber
committed
Fix const Option::unwrap_or()
Fixes #57
1 parent 60a7772 commit f2fa341

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

src/lib.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
#![feature(io_error_more)]
2-
#![feature(const_option_ext)]
32
#![forbid(unsafe_code)]
43

54
use std::path::Path;

src/provider/github.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,10 @@ use super::Project;
99
use super::Provider;
1010

1111
const ACCEPT_HEADER_JSON: &str = "application/vnd.github.v3+json";
12-
const GITHUB_API_BASEURL: &str =
13-
option_env!("GITHUB_API_BASEURL").unwrap_or("https://api.github.com");
12+
const GITHUB_API_BASEURL: &str = match option_env!("GITHUB_API_BASEURL") {
13+
Some(url) => url,
14+
None => "https://api.github.com",
15+
};
1416

1517
#[derive(Deserialize)]
1618
pub struct GithubProject {

src/provider/gitlab.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,10 @@ use super::Project;
99
use super::Provider;
1010

1111
const ACCEPT_HEADER_JSON: &str = "application/json";
12-
const GITLAB_API_BASEURL: &str = option_env!("GITLAB_API_BASEURL").unwrap_or("https://gitlab.com");
12+
const GITLAB_API_BASEURL: &str = match option_env!("GITLAB_API_BASEURL") {
13+
Some(url) => url,
14+
None => "https://gitlab.com",
15+
};
1316

1417
#[derive(Deserialize)]
1518
#[serde(rename_all = "lowercase")]

0 commit comments

Comments
 (0)