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:
1 parent
ff0fb56c67
commit
a02b555e66
1458 files changed
+10729
-21750
No files matched your search
@@ -13,10 +13,6 @@ use ratatui::text::{Line, Span};
|
||||
use super::progress_bar::progress_bar_spans;
|
||||
use crate::theme::Theme;
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Formatting utilities
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// Format a percentage as a fixed-width 5-char string.
|
||||
///
|
||||
/// - `< 10`: `"X.XX%"` (e.g. `"0.00%"`, `"5.12%"`)
|
||||
@@ -53,10 +49,6 @@ pub fn fmt_tokens(n: u64) -> String {
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Color blending
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// A breakpoint for color blending: at `pct` percent, the bar color is `color`.
|
||||
#[derive(Debug, Clone, Copy)]
|
||||
pub struct ColorBreakpoint {
|
||||
@@ -146,24 +138,14 @@ fn color_to_rgb(c: Color) -> (u8, u8, u8) {
|
||||
crate::render::color::resolve_to_rgb(c).unwrap_or((198, 198, 198))
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Status bar separator
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// The separator character between status bar items.
|
||||
pub const SEPARATOR: &str = "│";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Context bar line builder
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
/// Width of the percentage field on hover (`fmt_pct5` always returns 5 chars).
|
||||
const PCT_WIDTH: u16 = 5;
|
||||
/// Width of the gap between the progress bar and the percentage on hover.
|
||||
const BAR_PCT_GAP: u16 = 1;
|
||||
|
||||
// BAR_BG removed — use theme.bg_highlight directly (already quantized).
|
||||
|
||||
/// Build the context usage bar as a `Line<'static>`.
|
||||
///
|
||||
/// Normal: `8.5K / 1.0M` — actual token usage, colored by the same percentage
|
||||
@@ -243,10 +225,6 @@ pub fn context_bar_line_for_session(
|
||||
}
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Tests
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
@@ -261,7 +239,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_fmt_pct5_10_to_99() {
|
||||
assert_eq!(fmt_pct5(10.0), "10.0%");
|
||||
assert_eq!(fmt_pct5(20.16), "20.2%"); // rounds
|
||||
assert_eq!(fmt_pct5(20.16), "20.2%");
|
||||
assert_eq!(fmt_pct5(99.9), "99.9%");
|
||||
}
|
||||
|
||||
@@ -289,7 +267,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_fmt_tokens_thousands() {
|
||||
assert_eq!(fmt_tokens(1_200), "1.2K");
|
||||
assert_eq!(fmt_tokens(9_960), "10.0K"); // rounds up
|
||||
assert_eq!(fmt_tokens(9_960), "10.0K");
|
||||
assert_eq!(fmt_tokens(9_940), "9.9K");
|
||||
assert_eq!(fmt_tokens(12_000), "12K");
|
||||
assert_eq!(fmt_tokens(123_000), "123K");
|
||||
|
||||
Reference in new issue
Block a user