Skip to content

Conversation

@RAprogramm
Copy link
Owner

Summary

  • update the derive formatter generation to match on every TemplateFormatter variant and invoke the corresponding ::core::fmt trait or alternate formatting helper
  • extract helper functions to keep the generated tokens clear while preserving pointer semantics and the default display path
  • bump crate versions to 0.5.5/0.1.3, refresh the README dependency snippets and document the change in the changelog

Testing

  • cargo +nightly fmt --
  • cargo +1.90.0 clippy -- -D warnings
  • cargo +1.90.0 build --all-targets
  • cargo +1.90.0 test --all
  • cargo +1.90.0 doc --no-deps
  • cargo deny check
  • cargo audit

https://chatgpt.com/codex/tasks/task_e_68cce3e90278832b85aa0850144c3314

@RAprogramm RAprogramm merged commit c3dae09 into new_version Sep 19, 2025
1 of 2 checks passed
@RAprogramm RAprogramm deleted the codex/update-format_placeholder-for-templateformatter branch September 19, 2025 05:25
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

Codex Review: Here are some suggestions.

Reply with @codex fix comments to fix any unresolved comments.

About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you open a pull request for review, mark a draft as ready, or comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex fix this CI failure" or "@codex address that feedback".

Comment on lines +389 to +393
fn format_with_alternate(expr: TokenStream, specifier: char) -> TokenStream {
let format_string = format!("{{:#{}}}", specifier);
quote! {
::core::write!(f, #format_string, #expr)?;
}

Choose a reason for hiding this comment

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

[P0] Generate string literal using non-tokenizable String

The new helper format_with_alternate constructs a String with format! and then interpolates it directly into quote! (::core::write!(f, #format_string, #expr)?;). quote! requires the interpolated value to implement ToTokens, which String does not, so the proc-macro crate will fail to compile as soon as this arm is exercised. The previous implementation used a literal format string and compiled successfully. Convert the computed string into a token type (e.g. syn::LitStr::new(&format_string, Span::call_site())) before interpolation.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants