浏览代码

Make Github api url a constant

Santiago Pastorino 4 年之前
父节点
当前提交
6ed86c4c3a
共有 1 个文件被更改,包括 3 次插入5 次删除
  1. 3 5
      src/github.rs

+ 3 - 5
src/github.rs

@@ -630,9 +630,7 @@ pub struct Repository {
 }
 
 impl Repository {
-    fn base_url(&self) -> &str {
-        "https://api.github.com"
-    }
+    const GITHUB_API_URL: &'static str = "https://api.github.com";
 
     pub async fn get_issues<'a>(
         &self,
@@ -692,7 +690,7 @@ impl Repository {
             .join("&");
         format!(
             "{}/repos/{}/issues?{}",
-            self.base_url(),
+            Repository::GITHUB_API_URL,
             self.full_name,
             filters
         )
@@ -722,7 +720,7 @@ impl Repository {
             .join("+");
         format!(
             "{}/search/issues?q={}&sort=created&order=asc",
-            self.base_url(),
+            Repository::GITHUB_API_URL,
             filters
         )
     }