Chris Gioran on Nostr: #rustlang tip: If you want `cargo fmt` to skip formatting an individual expression ...
#rustlang tip:
If you want `cargo fmt` to skip formatting an individual expression (which it can't), you can instead wrap the expression in a block and apply the rustfmt::skip attribute to that.
This won't work:
```
let mut a;
#[rustfmt::skip]
a = vec![1,
2, 3];
```
but this does:
```
let mut a;
#[rustfmt::skip]
{
a = vec![1,
2, 3];
}
```
If you want `cargo fmt` to skip formatting an individual expression (which it can't), you can instead wrap the expression in a block and apply the rustfmt::skip attribute to that.
This won't work:
```
let mut a;
#[rustfmt::skip]
a = vec![1,
2, 3];
```
but this does:
```
let mut a;
#[rustfmt::skip]
{
a = vec![1,
2, 3];
}
```