Vscode-rust: How to disable automatic line breaks in formatter?

Created on 1 Sep 2018  路  2Comments  路  Source: rust-lang/vscode-rust

When I write this and save:

    let board = stdin.lock().lines().map(|r| r.unwrap()).take(3).collect::<String>();

It is automatically formatted like this:

    let board = stdin
        .lock()
        .lines()
        .map(|r| r.unwrap())
        .take(3)
        .collect::<String>();

Is there a way to prevent this or at least increase the line length where it begins (75) without disabling autoformatting completely? I've tried changing standard vs code settings for wrapping and rulers but it doesn't affect rls.

Most helpful comment

Thanks, I got the desired behavior by creating rustfmt.toml with just a single line:

max_width = 120

All 2 comments

Formatting is done by rustfmt. The link also explains how to setup a configuration file where you can disable certain formatting options.

Thanks, I got the desired behavior by creating rustfmt.toml with just a single line:

max_width = 120
Was this page helpful?
0 / 5 - 0 ratings