Skip to content

Commit 9d9ea52

Browse files
committed
replace std::iter::once(_) with [_]
much more concise
1 parent e8cf373 commit 9d9ea52

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

src/github.rs

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1503,16 +1503,11 @@ impl Repository {
15031503
let filters = filters
15041504
.iter()
15051505
.map(|(key, val)| format!("{key}={val}"))
1506-
.chain(std::iter::once(format!(
1507-
"labels={}",
1508-
include_labels.join(",")
1509-
)))
1510-
.chain(std::iter::once("filter=all".to_owned()))
1511-
.chain(std::iter::once(format!("sort={}", ordering.sort,)))
1512-
.chain(std::iter::once(
1513-
format!("direction={}", ordering.direction,),
1514-
))
1515-
.chain(std::iter::once(format!("per_page={}", ordering.per_page,)))
1506+
.chain([format!("labels={}", include_labels.join(","))])
1507+
.chain(["filter=all".to_owned()])
1508+
.chain([format!("sort={}", ordering.sort)])
1509+
.chain([format!("direction={}", ordering.direction)])
1510+
.chain([format!("per_page={}", ordering.per_page)])
15161511
.collect::<Vec<_>>()
15171512
.join("&");
15181513
format!(
@@ -1535,7 +1530,7 @@ impl Repository {
15351530
.map(|(key, val)| format!("{key}:{val}"))
15361531
.chain(include_labels.iter().map(|label| format!("label:{label}")))
15371532
.chain(exclude_labels.iter().map(|label| format!("-label:{label}")))
1538-
.chain(std::iter::once(format!("repo:{}", self.full_name)))
1533+
.chain([format!("repo:{}", self.full_name)])
15391534
.collect::<Vec<_>>()
15401535
.join("+");
15411536
format!(

0 commit comments

Comments
 (0)