Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct plural of arguments in format_args! #15785

Merged
merged 2 commits into from
Jul 20, 2014
Merged

Correct plural of arguments in format_args! #15785

merged 2 commits into from
Jul 20, 2014

Conversation

treeman
Copy link
Contributor

@treeman treeman commented Jul 18, 2014

Fix for #15780.

@alexcrichton
Copy link
Member

Could you add a test for this as well?

@@ -215,12 +215,21 @@ impl<'a, 'b> Context<'a, 'b> {
}
}

fn describe_num_args(&self) -> String {
if self.args.len() == 1 {
"there is 1 argument".to_string()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

before, this didn't allocate, but now it does, right?

I guess this doesn't matter with an error...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's right. I think the readability makes it worth it.

@treeman
Copy link
Contributor Author

treeman commented Jul 18, 2014

As for the tests, we want a file with:

format!("{0} {1}", 1);
//^~ ERROR invalid reference to argument `1` (there is 1 argument)

inside src/test/compile-fail and it will also check the error output?

@alexcrichton
Copy link
Member

Yeah, you can also just add a test case to src/test/compile-fail/ifmt-bad-arg.rs

bors added a commit that referenced this pull request Jul 20, 2014
@bors bors closed this Jul 20, 2014
@bors bors merged commit 820a558 into rust-lang:master Jul 20, 2014
@treeman treeman deleted the fix-15780 branch July 20, 2014 11:37
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants