Expand description
Small pure helpers: identifier casing, keyword handling, and comment scanning.
Functions§
- extend_
trailing_ comment - If the remainder of the line after
endis only a trailing//line comment, extendendto include it (but not the newline). Otherwise returnend. - is_
keyword - Is
namea Rust keyword (used to decide whether amod/useneeds adjustment)? - leading_
comment_ start - Given the gap between the previous item’s end and this item’s start, return the
byte offset at which a contiguous block of plain
//comments directly above the item begins. Doc-comments are already part of the item span, so they never appear here. Returnsitem_startwhen there is no attached comment block. - line_
start - Byte offset of the start of the line containing
byteinsrc. - to_
snake - Convert a Rust identifier (CamelCase, SCREAMING_SNAKE, or mixed) into a snake_case module file stem.