From 38ab20dbf7469aa5a3cb0d7bfd3700281aa46467 Mon Sep 17 00:00:00 2001 From: V1shvesh <22243137+V1shvesh@users.noreply.github.com> Date: Sun, 8 Sep 2019 14:57:03 +0530 Subject: [PATCH] Add pluralise macro Adress issue #64238. Create a macro to be used for pluralisation check throughout rustc codebase. --- src/librustc_errors/lib.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/librustc_errors/lib.rs b/src/librustc_errors/lib.rs index 6585633e00af..b5341a2b727a 100644 --- a/src/librustc_errors/lib.rs +++ b/src/librustc_errors/lib.rs @@ -845,3 +845,11 @@ impl Level { } } } + +#[macro_export] +macro_rules! pluralise { + ($x:expr) => { + if $x != 1 { "s" } else { "" } + }; +} +