A developer shares their philosophy of formatting Rust code using 'trees and lines' — one item per line for readability, clean diffs, and visible import hierarchies. The post covers a preferred rustfmt.toml configuration using `imports_granularity = "one"`, `imports_layout = "Vertical"`, and `fn_params_layout = "Vertical"`, and critiques cargo fmt's inconsistent formatting of match expressions. Also includes a Vim shortcut for applying custom rustfmt rules on demand without changing project-wide settings.

5m read timeFrom dystroy.org
Post cover image
Table of contents
LinesTreesFormatted imports and functionsAuto-formattingAnd what if you don't want to change the rustfmt rules ?

Sort: