Skip to content

Commit b88b5bc

Browse files
committed
free fn -> method
1 parent 365e094 commit b88b5bc

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

mdbook-goals/src/gh/labels.rs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,19 @@ pub struct GhLabel {
88
pub color: String,
99
}
1010

11-
pub fn list_labels(repository: &str) -> anyhow::Result<Vec<GhLabel>> {
12-
let output = Command::new("gh")
13-
.arg("-R")
14-
.arg(repository)
15-
.arg("label")
16-
.arg("list")
17-
.arg("--json")
18-
.arg("name,color")
19-
.output()?;
11+
impl GhLabel {
12+
pub fn list(repository: &str) -> anyhow::Result<Vec<GhLabel>> {
13+
let output = Command::new("gh")
14+
.arg("-R")
15+
.arg(repository)
16+
.arg("label")
17+
.arg("list")
18+
.arg("--json")
19+
.arg("name,color")
20+
.output()?;
2021

21-
let labels: Vec<GhLabel> = serde_json::from_slice(&output.stdout)?;
22+
let labels: Vec<GhLabel> = serde_json::from_slice(&output.stdout)?;
2223

23-
Ok(labels)
24+
Ok(labels)
25+
}
2426
}

mdbook-goals/src/rfc.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use crate::{
1313
gh::{
1414
issue_id::IssueId,
1515
issues::{list_issue_titles_in_milestone, lock_issue},
16-
labels::{list_labels, GhLabel},
16+
labels::GhLabel,
1717
},
1818
goal::{self, GoalDocument, ParsedOwners, PlanItem, Status},
1919
team::{get_person_data, TeamName},
@@ -222,7 +222,7 @@ fn initialize_labels(
222222
color: "5319E7".to_string(),
223223
});
224224

225-
for existing_label in list_labels(repository)? {
225+
for existing_label in GhLabel::list(repository)? {
226226
desired_labels.remove(&existing_label);
227227
}
228228

0 commit comments

Comments
 (0)