# -------------------------------------------------------------------------------------------------- # Sourced from a combination of # 1. rustfmt --print-config=default > rustfmt.toml # 2. rustfmt --help=config # 3. https://rust-lang.github.io/rustfmt/?version=v1.4.38&search= # -------------------------------------------------------------------------------------------------- required_version = "1.4.38" # Maximum width of an array literal before falling back to vertical formatting. # Default: 60 # Possible values: any positive integer that is less than or equal to the value specified for max_width array_width = 80 # Maximum width of the args of a function-like attributes before falling back to vertical formatting. # Default value: 70 # Possible values: any positive integer that is less than or equal to the value specified for max_width attr_fn_like_width = 100 # Where to put a binary operator when a binary expression goes multiline. # Default value: "Front" # Possible values: "Front", "Back" binop_separator = "Front" # Minimum number of blank lines which must be put between items. If two items have fewer blank lines # between them, additional blank lines are inserted. # Default value: 0 # Possible values: unsigned integer blank_lines_lower_bound = 0 # Maximum number of blank lines which can be put between items. If more than this number of consecutive # empty lines are found, they are trimmed down to match this integer. # Default value: 1 # Possible values: any non-negative integer blank_lines_upper_bound = 1 # Brace style for items # Default value: "SameLineWhere" # Possible values: "AlwaysNextLine", "PreferSameLine", "SameLineWhere" brace_style = "AlwaysNextLine" # Maximum length of a chain to fit on a single line. # Default: 60 # Possible values: any positive integer that is less than or equal to the value specified for max_width chain_width = 110 # Whether to use colored output or not. # Default value: "Auto" # Possible values: "Auto", "Always", "Never" color = "Auto" # Combine control expressions with function calls. # Default value: true # Possible values: true, false combine_control_expr = true # Maximum length of comments. No effect unless wrap_comments = true. # Default value: 80 # Possible values: any positive integer comment_width = 100 # Replace strings of _ wildcards by a single .. in tuple patterns # Default value: false # Possible values: true, false condense_wildcard_suffixes = false # Brace style for control flow constructs # Default value: "AlwaysSameLine" # Possible values: "AlwaysNextLine", "AlwaysSameLine", "ClosingNextLine" control_brace_style = "AlwaysSameLine" # Don't reformat anything # Default value: false # Possible values: true, false disable_all_formatting = false # Specifies which edition is used by the parser. # Default value: "2015" # Possible values: "2015", "2018", "2021" edition = "2021" # Put empty-body functions and impls on a single line # Default value: true # Possible values: true, false empty_item_single_line = true # The maximum length of enum variant having discriminant, that gets vertically aligned with others. # Variants without discriminants would be ignored for the purpose of alignment. # Note that this is not how much whitespace is inserted, but instead the longest variant name that # doesn't get ignored when aligning. # Default value : 0 # Possible values: any positive integer enum_discrim_align_threshold = 0 # Error if Rustfmt is unable to get all lines within max_width, except for comments and string # literals. If this happens, then it is a bug in Rustfmt. You might be able to work around the bug # by refactoring your code to avoid long/complex expressions, usually by extracting a local variable # or using a shorter name. # Default value: false # Possible values: true, false error_on_line_overflow = false # Error if unable to get comments or string literals within max_width, or they are left with trailing whitespaces. # Default value: false # Possible values: true, false error_on_unformatted = false # Control the layout of arguments in a function # Default value: "Tall" # Possible values: "Compressed", "Tall", "Vertical" fn_args_layout = "Compressed" # Maximum width of the args of a function call before falling back to vertical formatting. # Default value: 60 # Possible values: any positive integer that is less than or equal to the value specified for max_width fn_call_width = 110 # Put single-expression functions on a single line # Default value: false # Possible values: true, false fn_single_line = false # Always print the abi for extern items # Default value: true # Possible values: true, false force_explicit_abi = true # Force multiline closure and match arm bodies to be wrapped in a block # Default value: false # Possible values: false, true force_multiline_blocks = false # Format code snippet included in doc comments. # Default value: false # Possible values: true, false format_code_in_doc_comments = false # Format generated files. A file is considered generated if any of the first five lines contains @generated marker. # Default value: false # Possible values: true, false format_generated_files = false # Format the metavariable matching patterns in macros. # Default value: false # Possible values: true, false format_macro_matchers = false # Format the bodies of macros. # Default value: true # Possible values: true, false format_macro_bodies = true # Format string literals where necessary # Default value: false # Possible values: true, false format_strings = false # Controls the strategy for how imports are grouped together. # Default value: Preserve # Possible values: Preserve, StdExternalCrate group_imports = "StdExternalCrate" # Use tab characters for indentation, spaces for alignment # Default value: false # Possible values: true, false hard_tabs = false # Control the case of the letters in hexadecimal literal values # Default value: Preserve # Possible values: Upper, Lower hex_literal_case = "Preserve" # Do not show parse errors if the parser failed to parse files. # Default value: false # Possible values: true, false hide_parse_errors = false # Skip formatting files and directories that match the specified pattern. The pattern format is the # same as .gitignore. Be sure to use Unix/forwardslash / style paths. This path style will work on # all platforms. Windows style paths with backslashes \ are not supported. # Default value: format every file # Ignore specific files: ["src/types.rs", "src/foo/bar.rs"] # Ignore everything in examples: ["examples"] # Ignore everything below the rustfmt.toml location: ["/"] ignore = [] # Indent style of imports # Default Value: "Block" # Possible values: "Block", "Visual" imports_indent = "Block" # How imports should be grouped into use statements. Imports will be merged or split to the # configured level of granularity. # Default value: Preserve # Possible values: Preserve, Crate, Module, Item, One imports_granularity = "Preserve" # Item layout inside a imports block # Default value: "Mixed" # Possible values: "Horizontal", "HorizontalVertical", "Mixed", "Vertical" imports_layout = "Mixed" # Indent on expressions or items. # Default value: "Block" # Possible values: "Block", "Visual" indent_style = "Block" # Write an item and its attribute on the same line if their combined width is below a threshold # Default value: 0 # Possible values: any positive integer inline_attribute_width = 0 # Check whether beginnings of files match a license template. # Default value: "" # Possible values: path to a license template file license_template_path = "" # Wrap the body of arms in blocks when it does not fit on the same line with the pattern of arms # Default value: true # Possible values: true, false match_arm_blocks = true # Controls whether to include a leading pipe on match arms # Default value: Never # Possible values: Always, Never, Preserve match_arm_leading_pipes = "Never" # Put a trailing comma after a block based match arm (non-block arms are not affected) # Default value: false # Possible values: true, false match_block_trailing_comma = true # Maximum width of each line # Default value: 100 # Possible values: any positive integer max_width = 115 # Merge multiple derives into a single one. # Default value: true # Possible values: true, false merge_derives = true # Unix or Windows line endings # Default value: "Auto" # Possible values: "Auto", "Native", "Unix", "Windows" newline_style = "Unix" # Convert /* */ comments to // comments where possible # Default value: false # Possible values: true, false normalize_comments = true # Convert #![doc] and #[doc] attributes to //! and /// doc comments. # Default value: false # Possible values: true, false normalize_doc_attributes = false # When structs, slices, arrays, and block/array-like macros are used as the last argument # in an expression list, allow them to overflow (like blocks/closures) instead of being # indented on a new line. # Default value: false # Possible values: true, false overflow_delimited_expr = true # Remove nested parens. # Default value: true, # Possible values: true, false remove_nested_parens = true # Reorder impl items. type and const are put first, then macros and methods. # Default value: false # Possible values: true, false reorder_impl_items = false # Reorder import and extern crate statements alphabetically in groups (a group is separated by a newline). # Default value: true # Possible values: true, false reorder_imports = true # Reorder mod declarations alphabetically in group. # Default value: true # Possible values: true, false reorder_modules = true # Report FIXME items in comments. # Default value: "Never" # Possible values: "Always", "Unnumbered", "Never" report_fixme = "Never" # Report TODO items in comments. # Default value: "Never" # Possible values: "Always", "Unnumbered", "Never" report_todo = "Never" # Don't reformat out of line modules # Default value: false # Possible values: true, false skip_children = false # Leave a space after the colon. # Default value: true # Possible values: true, false space_after_colon = true # Leave a space before the colon. # Default value: false # Possible values: true, false space_before_colon = false # Put spaces around the .., ..=, and ... range operators # Default value: false # Possible values: true, false spaces_around_ranges = false # The maximum diff of width between struct fields to be aligned with each other. # Default value: 0 # Possible values: any non-negative integer struct_field_align_threshold = 0 # Put small struct literals on a single line # Default value: true # Possible values: true, false struct_lit_single_line = true struct_lit_width = 18 struct_variant_width = 35 single_line_if_else_max_width = 110 # Number of spaces per tab # Default value: 4 # Possible values: any positive integer tab_spaces = 4 # How to handle trailing commas for lists # Default value: "Vertical" # Possible values: "Always", "Never", "Vertical" trailing_comma = "Vertical" # Add trailing semicolon after break, continue and return # Default value: true # Possible values: true, false trailing_semicolon = true # Determines if + or = are wrapped in spaces in the punctuation of types # Default value: "Wide" # Possible values: "Compressed", "Wide" type_punctuation_density = "Compressed" # Enable unstable features on the unstable channel. # Default value: false # Possible values: true, false unstable_features = true # Use field initialize shorthand if possible. # Default value: false # Possible values: true, false use_field_init_shorthand = true # Whether to use different formatting for items and expressions if they satisfy a heuristic notion of 'small'. # Default value: "Default" # Possible values: "Default", "Off", "Max" use_small_heuristics = "Max" # Replace uses of the try! macro by the ? shorthand # Default value: false # Possible values: true, false use_try_shorthand = true # Which version of the formatting rules to use. Version::One is backwards-compatible with Rustfmt 1.0. # Other versions are only backwards compatible within a major version number. # Default value: One # Possible values: One, Two version = "One" # Forces the where clause to be laid out on a single line. # Default value: false # Possible values: true, false where_single_line = true # Break comments to fit on the line # Default value: false # Possible values: true, false wrap_comments = true