# SPDX-FileCopyrightText: 2023 - 2024 Ali Sajid Imami
#
# SPDX-License-Identifier: Apache-2.0
# SPDX-License-Identifier: MIT

# Personal configuration for the `rustfmt` tool.

# Stable options as of v1.6.0

## Use the 2021 edition of Rust
edition = "2021"

## Use the unix style line endings
newline_style = "Auto"

## Ensure if/else and let/else blocks are always on new lines
single_line_if_else_max_width = 0
single_line_let_else_max_width = 0

## Use field-init shorthand
use_field_init_shorthand = true

## Use the `?` instead of `try!`
use_try_shorthand = true

# Unstable options as of v1.6.0

## Enforce colored output
color = "Always"

## Configure comments
wrap_comments = true
comment_width = 80
normalize_comments = true

## Allow aligning of Enum Variants
enum_discrim_align_threshold = 20

## Format code in Doc Comments
doc_comment_code_block_width = 80
format_code_in_doc_comments = true

## Enforce string length limits
format_strings = true

## Imports Formatting
imports_indent = "Block"
imports_layout = "Vertical"
imports_granularity = "Crate"
reorder_imports = true
group_imports = "StdExternalCrate"

## Styling
indent_style = "Block"

## Impl styles
reorder_impl_items = true

## Module reordering
reorder_modules = true

## Struct formating
struct_field_align_threshold = 20
struct_lit_single_line = true
