Function clippy_utils::peel_blocks
source · pub fn peel_blocks<'a>(expr: &'a Expr<'a>) -> &'a Expr<'a>
Expand description
Removes blocks around an expression, only if the block contains just one expression and no statements. Unsafe blocks are not removed.
Examples:
{}
->{}
{ x }
->x
{{ x }}
->x
{ x; }
->{ x; }
{ x; y }
->{ x; y }
{ unsafe { x } }
->unsafe { x }