-
Notifications
You must be signed in to change notification settings - Fork 260
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
Inconsistency in formated output with respect to functions in standard lib. #407
Comments
The same code with |
We started special-casing the no-args case to minimize codegen, but it seems like that's not quite the correct behavior: https://github.com/rust-lang/log/blob/master/src/lib.rs#L1388-L1403. That special case will need to go away anyway to support https://github.com/rust-lang/rfcs/blob/master/text/2795-format-args-implicit-identifiers.md. |
There's a new API on Arguments that we should be able to use to recover this optimization: rust-lang/rust#74056 |
Fixed by #446. If Arguments.as_str stabilizes, we can use that to add the optimization back. |
Bumps [once_cell](https://github.com/matklad/once_cell) from 1.14.0 to 1.15.0. - [Release notes](https://github.com/matklad/once_cell/releases) - [Changelog](https://github.com/matklad/once_cell/blob/master/CHANGELOG.md) - [Commits](matklad/once_cell@v1.14.0...v1.15.0) --- updated-dependencies: - dependency-name: once_cell dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Using log 0.4.11, the following code:
produces this output:
This is due to
log/src/macros.rs
Line 36 in f06a18d
Standard rust macros (
format!
,write!
,println!
, ...) callstd::format_args!
which already handles both cases:https://github.com/rust-lang/rust/blob/ac48e62db85e6db4bbe026490381ab205f4a614d/library/alloc/src/macros.rs#L105-L110
https://github.com/rust-lang/rust/blob/4b0882cfaa33de2796eac01afeac69097fbccbd2/library/core/src/macros/mod.rs#L792-L795
If you think it is desirable to have a behavior that is analog to rust macros, I can try doing the change.
The text was updated successfully, but these errors were encountered: