1
Fork 0

Support other types of pluralization in pluralize macro

This commit is contained in:
est31 2022-03-14 17:55:14 +01:00
parent bce19cf7f1
commit 3bf9124f14
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
);