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

Support captured identifiers in format strings #2

Merged
merged 5 commits into from
Sep 10, 2022

Conversation

emilk
Copy link
Contributor

@emilk emilk commented Sep 10, 2022

Take the following:

let world = "world";
log_once::info_once!("Hello {world}");

Currently this logs "Hello {world}". This PR fixes this to instead log "Hello world", as expected.

See https://blog.rust-lang.org/2022/01/13/Rust-1.58.0.html#captured-identifiers-in-format-strings for more info about captured identifiers in format strings.

I also took the liberty of running cargo fmt

Copy link
Owner

@Luthaf Luthaf left a comment

Choose a reason for hiding this comment

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

Thanks for taking the time to do this! I'll release version 0.4.0 on crates.io ASAP (since this requires a newer rustc version)

EDIT: published https://crates.io/crates/log-once

@Luthaf Luthaf merged commit 5b0e377 into Luthaf:master Sep 10, 2022
@emilk
Copy link
Contributor Author

emilk commented Sep 10, 2022

Thanks for the quick merge and publish! 🙇

@emilk emilk deleted the captured-identifiers-in-format-strings branch September 10, 2022 17:11
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.

2 participants