Skip to content

Commit 10f7359

Browse files
committed
Improve formatting of work show
1 parent 25952e7 commit 10f7359

File tree

1 file changed

+20
-15
lines changed

1 file changed

+20
-15
lines changed

src/zulip.rs

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -366,21 +366,26 @@ async fn workqueue_commands(
366366
RotationMode::OffRotation => "off rotation",
367367
};
368368

369-
let prs = assigned_prs
370-
.iter()
371-
.map(|(pr_number, pr)| {
372-
format!(
373-
"- [#{pr_number}](https://github.com/rust-lang/rust/pull/{pr_number}) {}",
374-
pr.title
375-
)
376-
})
377-
.collect::<Vec<String>>()
378-
.join("\n");
379-
let mut response = format!(
380-
"`rust-lang/rust` PRs in your review queue ({} {}):\n{prs}\n",
381-
assigned_prs.len(),
382-
pluralize("PR", assigned_prs.len())
383-
);
369+
let mut response = if assigned_prs.is_empty() {
370+
"There are no PRs in your `rust-lang/rust` review queue\n".to_string()
371+
} else {
372+
let prs = assigned_prs
373+
.iter()
374+
.map(|(pr_number, pr)| {
375+
format!(
376+
"- [#{pr_number}](https://github.com/rust-lang/rust/pull/{pr_number}) {}",
377+
pr.title
378+
)
379+
})
380+
.collect::<Vec<String>>()
381+
.join("\n");
382+
format!(
383+
"`rust-lang/rust` PRs in your review queue ({} {}):\n{prs}\n\n",
384+
assigned_prs.len(),
385+
pluralize("PR", assigned_prs.len())
386+
)
387+
};
388+
384389
writeln!(response, "Review capacity: `{capacity}`\n")?;
385390
writeln!(response, "Rotation mode: *{rotation_mode}*\n")?;
386391
writeln!(response, "*Note that only certain PRs that are assigned to you are included in your review queue.*")?;

0 commit comments

Comments
 (0)