You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Removes the custom write_comma_separated utility function from cairo-lang-utils and replaces all call sites with itertools's format and format_with methods, which provide equivalent functionality more idiomatically.
Type of change
Please check one:
Bug fix (fixes incorrect behavior)
New feature
Performance improvement
Documentation change with concrete technical impact
Style, wording, formatting, or typo-only change
Why is this change needed?
write_comma_separated duplicated functionality already available via itertools::Itertools::format and format_with. Removing it reduces maintenance burden and consolidates formatting logic around the already-present itertools dependency.
What was the behavior or documentation before?
Comma-separated formatting in Display implementations was handled by a custom write_comma_separated function in cairo-lang-utils, requiring multiple write! calls (one for the opening delimiter, one for the content, one for the closing delimiter).
What is the behavior or documentation after?
The same formatting is achieved using itertools's .format(", ") and .format_with(", ", ...), allowing the entire formatted output to be expressed in a single write! call with inline format strings.
Related issue or discussion (if any)
N/A
Additional context
The write_comma_separated function and its associated use core::fmt import have been fully removed from cairo-lang-utils/src/lib.rs. All previously dependent crates (cairo-lang-executable, cairo-lang-sierra-generator, cairo-lang-sierra-to-casm, cairo-lang-sierra) now import itertools::Itertools directly.
Low Risk
Display-only refactor with no logic, API, or security changes; output formatting should be equivalent.
Overview
Removes write_comma_separated from cairo-lang-utils and switches comma-separated Display formatting to itertools (.format(", ") and .format_with) in executable compile output, pre-Sierra PushValues, CASM reference cells, and Sierra program pretty-printing.
Call sites collapse multi-step write! sequences into single format strings; behavior should match the old helper. cairo-lang-utils drops the unused core::fmt import tied to that function.
Reviewed by Cursor Bugbot for commit c840412. Bugbot is set up for automated code reviews on this repo. Configure here.
orizi
changed the base branch from
orizi/06-18-performance_general_rewrite_join_into_format_-_removing_intermediary_strings
to
graphite-base/10125June 18, 2026 09:00
The reason will be displayed to describe this comment to others. Learn more.
@TomerStarkware reviewed 5 files and all commit messages, and made 1 comment. Reviewable status: complete! all files reviewed, all discussions resolved (waiting on eytan-starkware).
orizi
deleted the
orizi/06-18-refactor_utils_removed_write_comma_separated_using_equivalent_.format_all_around
branch
June 21, 2026 12:15
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Removes the custom
write_comma_separatedutility function fromcairo-lang-utilsand replaces all call sites withitertools'sformatandformat_withmethods, which provide equivalent functionality more idiomatically.Type of change
Please check one:
Why is this change needed?
write_comma_separatedduplicated functionality already available viaitertools::Itertools::formatandformat_with. Removing it reduces maintenance burden and consolidates formatting logic around the already-presentitertoolsdependency.What was the behavior or documentation before?
Comma-separated formatting in
Displayimplementations was handled by a customwrite_comma_separatedfunction incairo-lang-utils, requiring multiplewrite!calls (one for the opening delimiter, one for the content, one for the closing delimiter).What is the behavior or documentation after?
The same formatting is achieved using
itertools's.format(", ")and.format_with(", ", ...), allowing the entire formatted output to be expressed in a singlewrite!call with inline format strings.Related issue or discussion (if any)
N/A
Additional context
The
write_comma_separatedfunction and its associateduse core::fmtimport have been fully removed fromcairo-lang-utils/src/lib.rs. All previously dependent crates (cairo-lang-executable,cairo-lang-sierra-generator,cairo-lang-sierra-to-casm,cairo-lang-sierra) now importitertools::Itertoolsdirectly.