docs(comments): rewrite comments across all crates to the guidelines

Sweep every first-party crate source (1956 .rs files) to the project comment
guidelines: delete redundant restatements, decorative banners, change
narration, and end-of-line comments; keep and tighten the crucial ones
(invariants, bug rationale, SAFETY blocks, ported-source attribution).

No functional code changed. Every edit is proven comment-only against the
prior tree by a comment-stripping lexer (string/char/raw-string aware) plus a
separate doctest-fence check. Where removing a comment made rustfmt or clippy
want to re-lay-out adjacent code, the minimal triggering comment is restored so
code tokens stay byte-identical.

Gates green: cargo fmt --all --check (0 diffs), cargo check and cargo clippy
--workspace --all-targets (0 warnings).

Adds scripts/check_codegen_comment_guidelines.py — the enforcement gate for
these guidelines (flags banners, end-of-line comments, change narration, and
commented-out code).
This commit is contained in:
2026-07-23 16:55:39 -04:00
parent ff0fb56c67
commit a02b555e66
1458 changed files with 10729 additions and 21750 deletions
@@ -31,8 +31,8 @@ fn build_marked_line(line_num: usize, content: &str) -> String {
fn generate_test_line(line_num: usize, terminal_width: usize) -> String {
let i = line_num - 1;
let mut line = match i % 3 {
0 => lipsum(4), // Short line
1 => lipsum(40), // Long line
0 => lipsum(4),
1 => lipsum(40),
2 => {
// Unicode string with ANSI colors and hyperlink for testing
let unicode_with_ansi = "\x1b[31m😀\u{200D}\x1b[0m\x1b[32mé\x1b[0m中\u{0300}\x1b[34mX\x1b[0m\x1b]8;;https://example.com\x1b\\H\x1b]8;;\x1b\\";
@@ -80,7 +80,8 @@ fn colorize_content(content: &str, color: CColor) -> String {
CColor::Magenta | CColor::DarkMagenta => 35,
CColor::Cyan | CColor::DarkCyan => 36,
CColor::White | CColor::Grey | CColor::DarkGrey => 37,
_ => 37, // Default to white for RGB or other colors
// Default to white for RGB or other colors
_ => 37,
};
format!("\x1b[{}m{}\x1b[0m", color_code, content)
}
@@ -240,7 +241,8 @@ fn main() -> Result<()> {
];
let mut line_num = 1;
let mut scrollback_history = String::new(); // has crlf-s instead of lf-s
// has crlf-s instead of lf-s
let mut scrollback_history = String::new();
loop {
match poll_for_key_or_animation(&spinner)? {