pub struct Config {
Show 66 fields pub max_width: Option<usize>, pub hard_tabs: Option<bool>, pub tab_spaces: Option<usize>, pub newline_style: Option<NewlineStyle>, pub indent_style: Option<IndentStyle>, pub use_small_heuristics: Option<Heuristics>, pub fn_call_width: Option<usize>, pub attr_fn_like_width: Option<usize>, pub struct_lit_width: Option<usize>, pub struct_variant_width: Option<usize>, pub array_width: Option<usize>, pub chain_width: Option<usize>, pub single_line_if_else_max_width: Option<usize>, pub wrap_comments: Option<bool>, pub format_code_in_doc_comments: Option<bool>, pub doc_comment_code_block_width: Option<usize>, pub comment_width: Option<usize>, pub normalize_comments: Option<bool>, pub normalize_doc_attributes: Option<bool>, pub format_strings: Option<bool>, pub format_macro_matchers: Option<bool>, pub format_macro_bodies: Option<bool>, pub hex_literal_case: Option<HexLiteralCase>, pub empty_item_single_line: Option<bool>, pub struct_lit_single_line: Option<bool>, pub fn_single_line: Option<bool>, pub where_single_line: Option<bool>, pub imports_indent: Option<IndentStyle>, pub imports_layout: Option<ListTactic>, pub imports_granularity: Option<ImportGranularity>, pub group_imports: Option<GroupImportsTactic>, pub merge_imports: Option<bool>, pub reorder_imports: Option<bool>, pub reorder_modules: Option<bool>, pub reorder_impl_items: Option<bool>, pub type_punctuation_density: Option<TypeDensity>, pub space_before_colon: Option<bool>, pub space_after_colon: Option<bool>, pub spaces_around_ranges: Option<bool>, pub binop_separator: Option<SeparatorPlace>, pub remove_nested_parens: Option<bool>, pub combine_control_expr: Option<bool>, pub short_array_element_width_threshold: Option<usize>, pub overflow_delimited_expr: Option<bool>, pub struct_field_align_threshold: Option<usize>, pub enum_discrim_align_threshold: Option<usize>, pub match_arm_blocks: Option<bool>, pub match_arm_leading_pipes: Option<MatchArmLeadingPipe>, pub force_multiline_blocks: Option<bool>, pub fn_args_layout: Option<Density>, pub brace_style: Option<BraceStyle>, pub control_brace_style: Option<ControlBraceStyle>, pub trailing_semicolon: Option<bool>, pub trailing_comma: Option<SeparatorTactic>, pub match_block_trailing_comma: Option<bool>, pub blank_lines_upper_bound: Option<usize>, pub blank_lines_lower_bound: Option<usize>, pub edition: Option<Edition>, pub version: Option<Version>, pub inline_attribute_width: Option<usize>, pub format_generated_files: Option<bool>, pub merge_derives: Option<bool>, pub use_try_shorthand: Option<bool>, pub use_field_init_shorthand: Option<bool>, pub force_explicit_abi: Option<bool>, pub condense_wildcard_suffixes: Option<bool>,
}
Expand description

rustfmt configuration.

See the rustfmt documentation for the descriptions of these stable and non-stable options.

Fields

max_width: Option<usize>

Maximum width of each line

hard_tabs: Option<bool>

Use tab characters for indentation, spaces for alignment

tab_spaces: Option<usize>

Number of spaces per tab

newline_style: Option<NewlineStyle>

Unix or Windows line endings

indent_style: Option<IndentStyle>

How do we indent expressions or items

use_small_heuristics: Option<Heuristics>

Whether to use different formatting for items and expressions if they satisfy a heuristic notion of ‘small’

fn_call_width: Option<usize>

Maximum width of the args of a function call before falling back to vertical formatting.

attr_fn_like_width: Option<usize>

Maximum width of the args of a function-like attributes before falling back to vertical formatting.

struct_lit_width: Option<usize>

Maximum width in the body of a struct lit before falling back to vertical formatting.

struct_variant_width: Option<usize>

Maximum width in the body of a struct variant before falling back to vertical formatting.

array_width: Option<usize>

Maximum width of an array literal before falling back to vertical formatting.

chain_width: Option<usize>

Maximum length of a chain to fit on a single line.

single_line_if_else_max_width: Option<usize>

Maximum line length for single line if-else expressions. A value of zero means always break if-else expressions.

wrap_comments: Option<bool>

Break comments to fit on the line

format_code_in_doc_comments: Option<bool>

Format the code snippet in doc comments.

doc_comment_code_block_width: Option<usize>

Maximum width for code snippets in doc comments. No effect unless format_code_in_doc_comments = true

comment_width: Option<usize>

Maximum length of comments. No effect unless wrap_comments = true

normalize_comments: Option<bool>

Convert /* */ comments to // comments where possible

normalize_doc_attributes: Option<bool>

Normalize doc attributes as doc comments

format_strings: Option<bool>

Format string literals where necessary

format_macro_matchers: Option<bool>

Format the metavariable matching patterns in macros

format_macro_bodies: Option<bool>

Format the bodies of macros

hex_literal_case: Option<HexLiteralCase>

Format hexadecimal integer literals

empty_item_single_line: Option<bool>

Put empty-body functions and impls on a single line

struct_lit_single_line: Option<bool>

Put small struct literals on a single line

fn_single_line: Option<bool>

Put single-expression functions on a single line

where_single_line: Option<bool>

Force where-clauses to be on a single line

imports_indent: Option<IndentStyle>

Indent of imports

imports_layout: Option<ListTactic>

Item layout inside a import block

imports_granularity: Option<ImportGranularity>

Merge or split imports to the provided granularity

group_imports: Option<GroupImportsTactic>

Controls the strategy for how imports are grouped together

merge_imports: Option<bool>

(deprecated: use imports_granularity instead)

reorder_imports: Option<bool>

Reorder import and extern crate statements alphabetically

reorder_modules: Option<bool>

Reorder module statements alphabetically in group

reorder_impl_items: Option<bool>

Reorder impl items

type_punctuation_density: Option<TypeDensity>

Determines if ‘+’ or ‘=’ are wrapped in spaces in the punctuation of types

space_before_colon: Option<bool>

Leave a space before the colon

space_after_colon: Option<bool>

Leave a space after the colon

spaces_around_ranges: Option<bool>

Put spaces around the .. and ..= range operators

binop_separator: Option<SeparatorPlace>

Where to put a binary operator when a binary expression goes multiline

remove_nested_parens: Option<bool>

Remove nested parens

combine_control_expr: Option<bool>

Combine control expressions with function calls

short_array_element_width_threshold: Option<usize>

Width threshold for an array element to be considered short

overflow_delimited_expr: Option<bool>

Allow trailing bracket/brace delimited expressions to overflow

struct_field_align_threshold: Option<usize>

Align struct fields if their diffs fits within threshold

enum_discrim_align_threshold: Option<usize>

Align enum variants discrims, if their diffs fit within threshold

match_arm_blocks: Option<bool>

Wrap the body of arms in blocks when it does not fit on the same line with the pattern of arms

match_arm_leading_pipes: Option<MatchArmLeadingPipe>

Determines whether leading pipes are emitted on match arms

force_multiline_blocks: Option<bool>

Force multiline closure bodies and match arms to be wrapped in a block

fn_args_layout: Option<Density>

Control the layout of arguments in a function

brace_style: Option<BraceStyle>

Brace style for items

control_brace_style: Option<ControlBraceStyle>

Brace style for control flow constructs

trailing_semicolon: Option<bool>

Add trailing semicolon after break, continue and return

trailing_comma: Option<SeparatorTactic>

How to handle trailing commas for lists

match_block_trailing_comma: Option<bool>

Put a trailing comma after a block based match arm (non-block arms are not affected)

blank_lines_upper_bound: Option<usize>

Maximum number of blank lines which can be put between items

blank_lines_lower_bound: Option<usize>

Minimum number of blank lines which must be put between items

edition: Option<Edition>

The edition of the parser (RFC 2052)

version: Option<Version>

Version of formatting rules

inline_attribute_width: Option<usize>

Write an item and its attribute on the same line if their combined width is below a threshold

format_generated_files: Option<bool>

Format generated files

merge_derives: Option<bool>

Merge multiple #[derive(...)] into a single one

use_try_shorthand: Option<bool>

Replace uses of the try! macro by the ? shorthand

use_field_init_shorthand: Option<bool>

Use field initialization shorthand if possible

force_explicit_abi: Option<bool>

Always print the abi for extern items

condense_wildcard_suffixes: Option<bool>

Replace strings of _ wildcards by a single .. in tuple patterns

Trait Implementations

Returns the “default value” for a type. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.