Skip to content

feat(s2n-events): Pre-format generated events with prettyplease#3117

Open
Mark-Simulacrum wants to merge 1 commit into
aws:mainfrom
Mark-Simulacrum:event-pretty
Open

feat(s2n-events): Pre-format generated events with prettyplease#3117
Mark-Simulacrum wants to merge 1 commit into
aws:mainfrom
Mark-Simulacrum:event-pretty

Conversation

@Mark-Simulacrum

Copy link
Copy Markdown
Collaborator

Release Summary:

Resolved issues:

n/a

Description of changes:

rustfmt has longstanding bugs where long lines will be left unchanged after it runs. Unfortunately, proc-macro2's output has no way to insert a newline in TokenStreams (only if we're willing to change how we output in the first place), and we'd have to manually pepper inserting them. prettyplease is aimed to guarantee that it will always break such lines up, so the subsequent rustfmt pass is more reliable.

Call-outs:

Unexpectedly to me, prettyplease also 'prettifies' known attributes, e.g., doc comments are made into nice syntax rather than being left as attributes. Ultimately that seems maybe even an improvement over the status quo; it shouldn't have any meaningful effect on rustdoc output. The handling of some more nuanced formatting where there's no knowledge of the macro being invoked (e.g., tracing::event/span!) is a bit more dubious, but I think isn't horrible.

This commit re-runs ./scripts/events. Notably this already fixes at least one pre-existing huge line (nominal_counter_offsets in dc aggregate metrics). I ran into this because adding more events was creatng more such cases where everything remains on one line.

This should overall have no functional change.

Testing:

CI should confirm events are up to date.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

rustfmt has longstanding bugs where long lines will be left unchanged
after it runs. Unfortunately, proc-macro2's output has no way to insert
a newline in TokenStreams (only if we're willing to change how we output
in the first place), and we'd have to manually pepper inserting them.
prettyplease is aimed to guarantee that it will always break such lines
up, so the subsequent rustfmt pass is more reliable.

Unexpectedly to me, prettyplease also 'prettifies' known attributes,
e.g., doc comments are made into nice syntax rather than being left as
attributes. Ultimately that seems maybe even an *improvement* over the
status quo; it shouldn't have any meaningful effect on rustdoc output.
The handling of some more nuanced formatting where there's no knowledge
of the macro being invoked (e.g., tracing::event/span!) is a bit more
dubious, but I think isn't horrible.

This commit re-runs ./scripts/events. Notably this already fixes at
least one pre-existing huge line (nominal_counter_offsets in dc
aggregate metrics). I ran into this because adding more events was
creatng more such cases where everything remains on one line.

This should overall have no functional change.
@Mark-Simulacrum Mark-Simulacrum marked this pull request as ready for review June 12, 2026 19:59
@Mark-Simulacrum Mark-Simulacrum requested review from a team as code owners June 12, 2026 19:59
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.

1 participant