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:
ZacharyZhang-NY committed 2026-07-23 16:55:39 -04:00
1 parent ff0fb56c67
commit a02b555e66
1458 files changed
+10729 -21750

No files matched your search

@@ -14,7 +14,8 @@ const K_CG_EVENT_SOURCE_STATE_HID_SYSTEM_STATE: i32 = 1;
// CGEventFlags bitmask constants from <CoreGraphics/CGEventTypes.h>
const K_CG_EVENT_FLAG_MASK_SHIFT: u64 = 0x0002_0000;
const K_CG_EVENT_FLAG_MASK_CONTROL: u64 = 0x0004_0000;
const K_CG_EVENT_FLAG_MASK_ALTERNATE: u64 = 0x0008_0000; // Option key
// Option key
const K_CG_EVENT_FLAG_MASK_ALTERNATE: u64 = 0x0008_0000;
const K_CG_EVENT_FLAG_MASK_COMMAND: u64 = 0x0010_0000;
fn flags() -> u64 {
+4 -4
View File
@@ -68,7 +68,7 @@ const REDRAW_CADENCE: Duration = Duration::from_millis(REDRAW_CADENCE_MS);
const DEFAULT_EVENTS_PER_TICK: u16 = 3;
const DEFAULT_WHEEL_LINES_PER_TICK: u16 = 3;
const DEFAULT_TRACKPAD_LINES_PER_TICK: u16 = 3; // NOTE: was 1
const DEFAULT_TRACKPAD_LINES_PER_TICK: u16 = 3;
const DEFAULT_SCROLL_MODE: ScrollInputMode = ScrollInputMode::Auto;
const DEFAULT_WHEEL_TICK_DETECT_MAX_MS: u64 = 12;
const DEFAULT_WHEEL_LIKE_MAX_DURATION_MS: u64 = 200;
@@ -1332,9 +1332,9 @@ impl ScrollStream {
};
let lines_per_tick = self.effective_lines_per_tick_f32();
// No intermediate clamps on `total` — clamping at MAX_ACCUMULATED_LINES
// (256) previously caused scroll to freeze once applied_lines caught up
// to the cap during long continuous trackpad gestures.
// No intermediate clamps on `total`: clamping at MAX_ACCUMULATED_LINES
// (256) would freeze scroll once applied_lines caught up to the cap
// during long continuous trackpad gestures.
//
// Safety: accumulated_events grows linearly with scroll events (~100-200/s
// on trackpad). At steady state, desired_lines and applied_lines track
@@ -282,14 +282,12 @@ fn direction_flip_closes_previous_stream() {
let _ = state.on_scroll_event_at(base + Duration::from_millis(2), ScrollDirection::Up, config);
let _ = state.on_scroll_event_at(base + Duration::from_millis(3), ScrollDirection::Up, config);
// Direction flip should close the previous stream
let update = state.on_scroll_event_at(
base + Duration::from_millis(4),
ScrollDirection::Down,
config,
);
// Should have at least 1 line from the new direction
assert!(update.lines >= 0);
}
@@ -1189,9 +1187,6 @@ fn multiplexed_sessions_use_conservative_profile_regardless_of_brand() {
assert_eq!(overridden.events_per_tick, 5);
}
// ── User-facing scroll settings (scroll_mode / invert_scroll /
// scroll_lines) — override plumbing + forced-mode pricing ──────────────
/// The settings caches assemble into overrides and reach the config through
/// `from_terminal_context`: forced mode, inverted direction, and the single
/// `scroll_lines` knob overriding BOTH per-tick values.