Skip to content

println!(123) works, but print!(123) and format!(123) do not #31556

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

Closed
niconii opened this issue Feb 11, 2016 · 4 comments
Closed

println!(123) works, but print!(123) and format!(123) do not #31556

niconii opened this issue Feb 11, 2016 · 4 comments

Comments

@niconii
Copy link
Contributor

niconii commented Feb 11, 2016

println! uses concat!($fmt, "\n") internally, which for literals converts $fmt into a string before concatenating. Because of this, println!(123) is accepted.

That said, rather than make println! as strict as print! and format!, it would be nice if format_args!(foo) could become shorthand for format_args!("{}", foo), somewhat similar to what panic! does.

@durka
Copy link
Contributor

durka commented Feb 11, 2016

relevant #30143

@niconii
Copy link
Contributor Author

niconii commented Feb 11, 2016

Oh, whoops, is this a dupe, then? That seems more about making a breaking change to println! (and writeln!) to be less permissive about what they accept, whereas I'd personally like format_args! to be more permissive.

@durka
Copy link
Contributor

durka commented Feb 11, 2016

I guess it's a duplicate, but the opinion in the other issue seemed to be that strictifying would be better than loosening. Loosening wouldn't be a breaking change, though. I guess an RFC would be required.

@alexcrichton
Copy link
Member

Ah yeah I think this is a dupe of #30143 so I'm going to close in favor of that (which was previously decided as a whelp-this-would-be-nice-to-fix-but-2.0 kind of thing)

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

No branches or pull requests

3 participants