Skip to contentSlop Block

require-blank-line-before-comment

Warning

Leave a blank line before a comment inside a body, unless it is the first line of the block or continues another comment.

fn run() {	let user = load();	// Only send email if not in noop modeLeave a blank line before this comment	send(user);}
// ast-grep-ignore: require-blank-line-before-comment-rust

How to fix

A comment inside a body starts a new group. You can skip the blank line if the comment is on the first line of the block or directly below another comment.

The check reads the enclosing block's text because the syntax tree omits blank lines. If the block has several violations of this rule, the report can land on a neighboring node.