Skip to content

Commit 0d04078

Browse files
committed
generator: format code
1 parent f155400 commit 0d04078

File tree

1 file changed

+33
-16
lines changed

1 file changed

+33
-16
lines changed

util/generator/src/github/issues.rs

Lines changed: 33 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -58,28 +58,36 @@ pub async fn get_in_progress(
5858

5959
let mut all_uri = String::from("https://api.github.com/search/issues?q=repo:Rust-GCC/gccrs+type:issue+state:open");
6060
let mut no_assignee_uri = String::from("https://api.github.com/search/issues?q=repo:Rust-GCC/gccrs+type:issue+state:open+no:assignee");
61+
6162
if bug
6263
{
6364
all_uri.push_str("+label:bug");
6465
no_assignee_uri.push_str("+label:bug");
6566
}
66-
let all = gh._get(all_uri).await.unwrap();
6767

68+
let all = gh._get(all_uri).await.unwrap();
6869
let no_assignee = gh._get(no_assignee_uri).await.unwrap();
6970

7071
let serres: Value = serde_json::from_str(gh.body_to_string(all).await.unwrap().as_str())?;
7172
let serres_no: Value = serde_json::from_str(gh.body_to_string(no_assignee).await.unwrap().as_str())?;
72-
let nb_all = match serres["total_count"].as_u64()
73+
74+
let nb_all = if let Some(x) = serres["total_count"].as_u64()
75+
{
76+
x
77+
}
78+
else
7379
{
74-
Some(x) => x,
75-
None => 0
80+
0
7681
};
77-
78-
let nb_no= match serres_no["total_count"].as_u64()
82+
let nb_no = if let Some(x) = serres_no["total_count"].as_u64()
7983
{
80-
Some(x) => x,
81-
None => 0
84+
x
85+
}
86+
else
87+
{
88+
0
8289
};
90+
8391
Ok(nb_all - nb_no)
8492
}
8593

@@ -89,21 +97,26 @@ pub async fn get_in_progress(
8997
) -> Result<u64, Error> {
9098

9199
let mut no_assignee_uri = String::from("https://api.github.com/search/issues?q=repo:Rust-GCC/gccrs+type:issue+state:open+no:assignee");
100+
92101
if bug
93102
{
94103
no_assignee_uri.push_str("+label:bug")
95104
}
105+
96106
let no_assignee = gh._get(no_assignee_uri).await.unwrap();
97107

98108
let serres_no: Value = serde_json::from_str(gh.body_to_string(no_assignee).await.unwrap().as_str())?;
99109

100-
let nb_no= match serres_no["total_count"].as_u64()
110+
let nb_no = if let Some(x) = serres_no["total_count"].as_u64()
101111
{
102-
Some(x) => x,
103-
None => 0
112+
x
113+
}
114+
else
115+
{
116+
0
104117
};
118+
105119
Ok(nb_no)
106-
107120
}
108121

109122
pub async fn get_closed(
@@ -112,6 +125,7 @@ pub async fn get_in_progress(
112125
) -> Result<u64, Error> {
113126

114127
let mut no_assignee_uri = String::from("https://api.github.com/search/issues?q=repo:Rust-GCC/gccrs+type:issue+state:closed");
128+
115129
if bug
116130
{
117131
no_assignee_uri.push_str("+label:bug")
@@ -121,11 +135,14 @@ pub async fn get_in_progress(
121135

122136
let serres_no: Value = serde_json::from_str(gh.body_to_string(no_assignee).await.unwrap().as_str())?;
123137

124-
let nb_no= match serres_no["total_count"].as_u64()
138+
let nb_no = if let Some(x) = serres_no["total_count"].as_u64()
139+
{
140+
x
141+
}
142+
else
125143
{
126-
Some(x) => x,
127-
None => 0
144+
0
128145
};
146+
129147
Ok(nb_no)
130-
131148
}

0 commit comments

Comments
 (0)