You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hey there! I've started handing over my code to rustfmt and it's working almost perfectly but I find that chain_width isn't doing what I'd like.
In general, I split chains when the number of function calls is greater than 3 as it helps me better understand what the chunk of code is doing at a glance. If the chain is only two functions but their names are absurdly long it's clear enough. Here's an example from my own codebase where I'm hitting this sort of thing. I'm not sure if others are hitting this as well, but I'm finding it's making my code less readable in a way I can't easily fix.
let authors = env!("CARGO_PKG_AUTHORS").split(":").map(|x| x.to_string()).collect(),
Now:
let authors = env!("CARGO_PKG_AUTHORS").split(":").map(|x| x.to_string()).collect(),
There also doesn't seem to be a way to disable it? So my option is careful inspection.
The text was updated successfully, but these errors were encountered:
Similar feature requests have been asked for in the past (#3538, #2263). Your best bet is to use #[rustfmt::skip] if you need more control over chain formatting for now.
Hey there! I've started handing over my code to
rustfmt
and it's working almost perfectly but I find thatchain_width
isn't doing what I'd like.In general, I split chains when the number of function calls is greater than 3 as it helps me better understand what the chunk of code is doing at a glance. If the chain is only two functions but their names are absurdly long it's clear enough. Here's an example from my own codebase where I'm hitting this sort of thing. I'm not sure if others are hitting this as well, but I'm finding it's making my code less readable in a way I can't easily fix.
Now:
There also doesn't seem to be a way to disable it? So my option is careful inspection.
The text was updated successfully, but these errors were encountered: