Expand description
comments command: list every comment span in a set of files, apply a hash-guarded
batch of delete/replace edits to them, and verify that code is unchanged once comments
are ignored.
syn drops // and /* */ comments and turns /// / //! into #[doc] attributes, so
it cannot answer “where are the comments”. This module runs a small lexer over the raw
source that understands strings, raw strings, char literals vs lifetimes and nested block
comments, and uses syn only for the questions syn is good at: which item a comment is
attached to, whether it sits inside a fn body, and whether two files are the same code.
Every apply is gated by the same verify check before anything is written, and records
a whole-file backup under one run_id so rs-hack revert <run_id> undoes the batch.
Structs§
- Apply
Args - Apply
Report - Attached
Item - Comment
Op - One op in an apply batch, resolved by
hashalone – pre-1.0, there is nospanfield and no fallback. - Comment
Span - Difference
- File
Verdict - List
Args - List
Report - OpOutcome
- Verify
Report
Enums§
Constants§
- ANNOTATION_
MARKERS - Annotation markers the board indexes; a span holding one is refused by
applyunless the caller opts in, and flagged bylistso callers can exclude it. - FILE_
BACKUP_ NODE_ TYPE - Node type recorded on the whole-file backup an
applyrun saves;restore_from_nodeswritesoriginal_contentstraight back for it.
Functions§
- apply
- compare_
sources - Compare two sources as code.
Ok(None)means equal modulo comments, whitespace and doc attributes;Ok(Some(d))names the first item that differs. - list
- parse_
batch - parse_
line_ range - Parse a
--lines A-Bargument: 1-indexed, inclusive,A <= B. - render_
apply - render_
list - render_
verify - to_
batch - The
comments list --format batchpayload: one ready-made"keep"op stub per non-annotation span inreport. - verify