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:
@@ -11,7 +11,6 @@ use crate::theme::Theme;
|
||||
/// Status bar showing context information.
|
||||
///
|
||||
/// Displays: token count, current turn, view mode, etc.
|
||||
/// Respects layout: first 3 cols and last 2 cols are empty.
|
||||
pub struct StatusBar<'a> {
|
||||
/// Left-aligned content (e.g., "Context: 5.2k tokens")
|
||||
pub left: &'a str,
|
||||
@@ -31,13 +30,11 @@ impl<'a> StatusBar<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
/// Add center content.
|
||||
pub fn center(mut self, text: &'a str) -> Self {
|
||||
self.center = Some(text);
|
||||
self
|
||||
}
|
||||
|
||||
/// Add right content.
|
||||
pub fn right(mut self, text: &'a str) -> Self {
|
||||
self.right = Some(text);
|
||||
self
|
||||
@@ -52,8 +49,6 @@ impl Widget for StatusBar<'_> {
|
||||
|
||||
let theme = Theme::current();
|
||||
|
||||
// Layout: outer block already has 2-char horizontal padding
|
||||
// No additional margins needed
|
||||
let left_margin = 0u16;
|
||||
let right_margin = 0u16;
|
||||
let content_x = area.x + left_margin;
|
||||
@@ -65,14 +60,11 @@ impl Widget for StatusBar<'_> {
|
||||
|
||||
let style = Style::default().fg(theme.gray).bg(theme.bg_base);
|
||||
|
||||
// Fill background (the whole row)
|
||||
buf.set_style(area, Style::default().bg(theme.bg_base));
|
||||
|
||||
// Left content
|
||||
let left_span = Span::styled(self.left, style);
|
||||
buf.set_span(content_x, area.y, &left_span, content_width);
|
||||
|
||||
// Center content (if fits)
|
||||
if let Some(center) = self.center {
|
||||
let center_width = center.len() as u16;
|
||||
let center_x = content_x + (content_width.saturating_sub(center_width)) / 2;
|
||||
@@ -82,7 +74,6 @@ impl Widget for StatusBar<'_> {
|
||||
}
|
||||
}
|
||||
|
||||
// Right content
|
||||
if let Some(right) = self.right {
|
||||
let right_width = right.len() as u16;
|
||||
let right_x = content_x + content_width.saturating_sub(right_width);
|
||||
|
||||
Reference in New Issue
Block a user