Skip to contentSlop Block

require-blank-line-after-multiline-statement

Warning

Leave a blank line after a multi-line statement, such as a control-flow block, an if or loop without braces, a method chain or a multi-line literal.

fn run(value: u8) -> u8 {	if value > 10 {Leave a blank line after this multi-line statement		return 10;	}	let doubled = value * 2;	return doubled;}
fn run(value: Option<u8>) -> u8 {	let Some(value) = value else {Leave a blank line after this multi-line statement		return 0;	};	return value;}
fn run(connection: &PgPool) -> Result<User> {	let user = User::find_by_id(connection, &id)Leave a blank line after this multi-line statement		.await?		.ok_or_else(|| ApplicationError::NotFound("User"))?;	return Ok(user);}
// ast-grep-ignore: require-blank-line-after-multiline-statement-rust

How to fix

A multi-line if, loop, match, let-else, literal or method chain ends a group of statements.

The check reads the enclosing block's text because the syntax tree omits blank lines. If the block is missing more than one blank line, the report can land on a neighboring statement.