1
Fork 0

Rollup merge of #94958 - est31:pluralize, r=oli-obk

Support other types of pluralization in pluralize macro
This commit is contained in:
Matthias Krüger 2022-03-15 17:15:55 +01:00 committed by GitHub
commit 183262d8d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 26 additions and 23 deletions

View file

@ -400,7 +400,7 @@ impl fmt::Display for UndefinedBehaviorInfo<'_> {
Pointer::new(*alloc, access.access_offset),
access.uninit_size.bytes(),
pluralize!(access.uninit_size.bytes()),
if access.uninit_size.bytes() != 1 { "are" } else { "is" },
pluralize!("is", access.uninit_size.bytes()),
Pointer::new(*alloc, access.uninit_offset),
),
InvalidUninitBytes(None) => write!(

View file

@ -847,7 +847,7 @@ fn foo(&self) -> Self::T { String::new() }
"{some} method{s} {are} available that return{r} `{ty}`",
some = if methods.len() == 1 { "a" } else { "some" },
s = pluralize!(methods.len()),
are = if methods.len() == 1 { "is" } else { "are" },
are = pluralize!("is", methods.len()),
r = if methods.len() == 1 { "s" } else { "" },
ty = expected
);