File tree Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Expand file tree Collapse file tree 3 files changed +17
-1
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,7 @@ pub mod rfcbot;
23
23
pub mod team;
24
24
mod team_data;
25
25
pub mod triage;
26
+ mod utils;
26
27
pub mod zulip;
27
28
28
29
#[ cfg( test) ]
Original file line number Diff line number Diff line change
1
+ use std:: borrow:: Cow ;
2
+
3
+ /// Pluralize (add an 's' sufix) to `text` based on `count`.
4
+ pub fn pluralize ( text : & str , count : usize ) -> Cow < str > {
5
+ if count == 1 {
6
+ text. into ( )
7
+ } else {
8
+ format ! ( "{}s" , text) . into ( )
9
+ }
10
+ }
Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ use crate::handlers::docs_update::docs_update;
6
6
use crate :: handlers:: pr_tracking:: get_assigned_prs;
7
7
use crate :: handlers:: project_goals:: { self , ping_project_goals_owners} ;
8
8
use crate :: handlers:: Context ;
9
+ use crate :: utils:: pluralize;
9
10
use anyhow:: { format_err, Context as _} ;
10
11
use std:: env;
11
12
use std:: fmt:: Write as _;
@@ -291,7 +292,11 @@ async fn workqueue_commands(
291
292
None => String :: from ( "Not set (i.e. unlimited)" ) ,
292
293
} ;
293
294
294
- let mut response = format ! ( "`rust-lang/rust` PRs in your review queue: {prs}\n " ) ;
295
+ let mut response = format ! (
296
+ "`rust-lang/rust` PRs in your review queue: {prs} ({} {})\n " ,
297
+ prs. len( ) ,
298
+ pluralize( "PR" , prs. len( ) )
299
+ ) ;
295
300
writeln ! ( response, "Review capacity: {capacity}\n " ) ?;
296
301
writeln ! ( response, "*Note that only selected PRs that are assigned to you are considered as being in the review queue.*" ) ?;
297
302
response
You can’t perform that action at this time.
0 commit comments