Input file:
fn main() {
aaaaaaaaaaaaaaaaaaaaa :: bbbbbbbbbbbbbbbbbb :: ccccccccccccccccccccccccccccccccccccccc :: dddddddddddddddddddd ( eeeeeeeeeeeeeeeeeeee :: ffffffffffffffffffff ( ggggggggg ( hhhhhhhhhhhhhhhh ) , iiiiiiiii ( jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj ) ) );
}
As of current master (c0e616b), cargo run --manifest-path path/to/rustfmt/Cargo.toml --release --bin rustfmt <main.rs leaves the long line in this file unchanged.
Shortening the input line such that it can fit within rustfmt's default max_width produces good formatting, as expected:
fn main() {
bbbbbbbbbbbbbbbbbb::ccccccccccccccccccccccccccccccccccccccc::dddddddddddddddddddd(
eeeeeeeeeeeeeeeeeeee::ffffffffffffffffffff(
ggggggggg(hhhhhhhhhhhhhhhh),
iiiiiiiii(jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj),
),
);
}
If I configure max_width = 1000, I get correct but very wide formatting, as expected:
fn main() {
aaaaaaaaaaaaaaaaaaaaa::bbbbbbbbbbbbbbbbbb::ccccccccccccccccccccccccccccccccccccccc::dddddddddddddddddddd(eeeeeeeeeeeeeeeeeeee::ffffffffffffffffffff(ggggggggg(hhhhhhhhhhhhhhhh), iiiiiiiii(jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj)));
}
Is there anything I can set to end up with best-effort formatting, even for content wider than max_width, rather than leaving long lines totally unformatted? Here is what I would want:
fn main() {
aaaaaaaaaaaaaaaaaaaaa::bbbbbbbbbbbbbbbbbb::ccccccccccccccccccccccccccccccccccccccc::dddddddddddddddddddd(
eeeeeeeeeeeeeeeeeeee::ffffffffffffffffffff(
ggggggggg(hhhhhhhhhhhhhhhh),
iiiiiiiii(jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj),
),
);
}
Input file:
As of current master (c0e616b),
cargo run --manifest-path path/to/rustfmt/Cargo.toml --release --bin rustfmt <main.rsleaves the long line in this file unchanged.Shortening the input line such that it can fit within rustfmt's default max_width produces good formatting, as expected:
If I configure
max_width = 1000, I get correct but very wide formatting, as expected:Is there anything I can set to end up with best-effort formatting, even for content wider than max_width, rather than leaving long lines totally unformatted? Here is what I would want: