diff options
| author | bors <bors@rust-lang.org> | 2023-08-22 14:22:10 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-08-22 14:22:10 +0000 |
| commit | 3e9e5745dfd3ad9a553a4c7d2b3d125dc1473fa6 (patch) | |
| tree | dd81fa640bc1e0ddf628cc35dbd70af1f260414c /compiler/rustc_codegen_gcc/src | |
| parent | d8c69dfb37241a2b750a2acbbab48d1201d00766 (diff) | |
| parent | 5dce0e66b9424ed1070e5b37ca21ffee62957595 (diff) | |
| download | rust-3e9e5745dfd3ad9a553a4c7d2b3d125dc1473fa6.tar.gz rust-3e9e5745dfd3ad9a553a4c7d2b3d125dc1473fa6.zip | |
Auto merge of #115066 - allaboutevemirolive:pluralize_macro, r=Nilstrieb
Redefine the pluralize macro's arm
Redefine the unintuitive pluralize macro's arm because of the negation. The initial code starts with check if count is not 1, which is confusing and unintuitive.
The arm shoud start with checking,
- if "count" `is 1` then, append `""` (empty string) - indicate as singular
- Then check if "count" `is not 1` (more than 1), append `"s"` - indicate as plural
Before:
```rs
// This arm is abit confusing since it start with checking, if "count" is more than 1, append "s".
($x:expr) => {
if $x != 1 { "s" } else { "" }
};
```
After:
```rs
// Pluralize based on count (e.g., apples)
($x:expr) => {
if $x == 1 { "" } else { "s" }
};
```
Diffstat (limited to 'compiler/rustc_codegen_gcc/src')
0 files changed, 0 insertions, 0 deletions
