Skip to content

Instantly share code, notes, and snippets.

@cstrachan88
Last active December 12, 2023 10:52
Show Gist options
  • Save cstrachan88/312cbfdeb831a1b50bd0bda3c3799380 to your computer and use it in GitHub Desktop.
Save cstrachan88/312cbfdeb831a1b50bd0bda3c3799380 to your computer and use it in GitHub Desktop.
Global rustfmt config
# https://rust-lang.github.io/rustfmt/
# Windows: %AppData%\rustfmt\rustfmt.toml
# Run with following command - unstable_features = true doesn't seem to work on it's own
# `cargo +nightly fmt`
# add `--check` to verify changes first
# Can also add following to vscode settings to have rustfmt nightly on save
# "[rust]": {
# "editor.defaultFormatter": "rust-lang.rust-analyzer",
# "editor.formatOnSave": true,
# "editor.tabSize": 4
# },
# "rust-analyzer.rustfmt.extraArgs": [
# "+nightly"
# ]
# edition = "2021"
use_small_heuristics = "Max"
max_width = 200
fn_params_layout = "Compressed"
hard_tabs = false
match_block_trailing_comma = true
newline_style = "Native"
use_field_init_shorthand = true
use_try_shorthand = true
unstable_features = true
# Unstable features -- nightly channel only
normalize_doc_attributes = true
fn_single_line = true
where_single_line = true
imports_granularity = "Crate"
group_imports = "StdExternalCrate"
reorder_impl_items = true
overflow_delimited_expr = true
struct_field_align_threshold = 8
brace_style = "PreferSameLine"
control_brace_style = "ClosingNextLine"
# trailing_comma = "Always"
blank_lines_upper_bound = 4
inline_attribute_width = 50
condense_wildcard_suffixes = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment