How can I switch off rustfmt for a region of code instead of a single item?

You could put the functions you do not want to format in a module, tag the entire module with a #[rustfmt::skip], then pull in the items to the parent module with use.

#[rustfmt::skip]
mod unformatted {
    pub fn add(a : i32, b : i32) -> i32 { a + b }
    pub fn sub(a : i32, b : i32) -> i32 { a - b }
}

use unformatted::*;

fn main() {
    dbg!(add(2, 3));
}

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)