Skip to main content

leading_comment_start

Function leading_comment_start 

Source
pub fn leading_comment_start(
    src: &str,
    gap_start: usize,
    item_start: usize,
) -> usize
Expand description

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. Returns item_start when there is no attached comment block.

A comment block is “attached” only if it is immediately above the item with no intervening blank line.