Skip to main content

Recipes

Raise current expression in a block (Rust)

Say we have the following code:

fn main() -> usize {
let x = 123;
Some(x)
}

If you want to change the code to become:

fn main() -> usize {
123
}

... you cannot just Raise 123, as that would do nothing since replacing the block with 123 introduces syntax error.

To make that work, surround 123 with curly brackets (by pressing v s { 1) before raising.

Footnotes

  1. See Surround