├── .editorconfig ├── .gitattributes ├── .github └── workflows │ ├── check_diff.yml │ ├── integration.yml │ ├── linux.yml │ ├── mac.yml │ ├── rustdoc_check.yml │ ├── upload-assets.yml │ └── windows.yml ├── .gitignore ├── CHANGELOG.md ├── CODE_OF_CONDUCT.md ├── Cargo.lock ├── Cargo.toml ├── Configurations.md ├── Contributing.md ├── Design.md ├── LICENSE-APACHE ├── LICENSE-MIT ├── Makefile.toml ├── Processes.md ├── README.md ├── atom.md ├── bootstrap.sh ├── build.rs ├── check_diff ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── src │ ├── lib.rs │ └── main.rs └── tests │ ├── bash_commands.rs │ ├── check_diff.rs │ └── git.rs ├── ci ├── build_and_test.bat ├── build_and_test.sh ├── check_diff.sh └── integration.sh ├── config_proc_macro ├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── src │ ├── attrs.rs │ ├── config_type.rs │ ├── item_enum.rs │ ├── item_struct.rs │ ├── lib.rs │ └── utils.rs └── tests │ └── smoke.rs ├── docs └── index.html ├── intellij.md ├── rust-toolchain ├── rustfmt.toml ├── src ├── attr.rs ├── attr │ └── doc_comment.rs ├── bin │ └── main.rs ├── cargo-fmt │ ├── main.rs │ └── test │ │ ├── message_format.rs │ │ ├── mod.rs │ │ └── targets.rs ├── chains.rs ├── closures.rs ├── comment.rs ├── config │ ├── config_type.rs │ ├── file_lines.rs │ ├── lists.rs │ ├── macro_names.rs │ ├── mod.rs │ ├── options.rs │ └── style_edition.rs ├── coverage.rs ├── emitter.rs ├── emitter │ ├── checkstyle.rs │ ├── checkstyle │ │ └── xml.rs │ ├── diff.rs │ ├── files.rs │ ├── files_with_backup.rs │ ├── json.rs │ ├── modified_lines.rs │ └── stdout.rs ├── expr.rs ├── format-diff │ ├── main.rs │ └── test │ │ └── bindgen.diff ├── format_report_formatter.rs ├── formatting.rs ├── formatting │ ├── generated.rs │ └── newline_style.rs ├── git-rustfmt │ └── main.rs ├── ignore_path.rs ├── imports.rs ├── items.rs ├── lib.rs ├── lists.rs ├── macros.rs ├── matches.rs ├── missed_spans.rs ├── modules.rs ├── modules │ └── visitor.rs ├── overflow.rs ├── pairs.rs ├── parse │ ├── macros │ │ ├── asm.rs │ │ ├── cfg_if.rs │ │ ├── cfg_match.rs │ │ ├── lazy_static.rs │ │ └── mod.rs │ ├── mod.rs │ ├── parser.rs │ └── session.rs ├── patterns.rs ├── release_channel.rs ├── reorder.rs ├── rewrite.rs ├── rustfmt_diff.rs ├── shape.rs ├── skip.rs ├── sort.rs ├── source_file.rs ├── source_map.rs ├── spanned.rs ├── stmt.rs ├── string.rs ├── syntux.rs ├── test │ ├── configuration_snippet.rs │ ├── mod.rs │ ├── mod_resolver.rs │ └── parser.rs ├── types.rs ├── utils.rs ├── vertical.rs └── visitor.rs ├── tests ├── cargo-fmt │ ├── main.rs │ └── source │ │ ├── divergent-crate-dir-names │ │ ├── Cargo.toml │ │ ├── dependency-dir-name │ │ │ ├── Cargo.toml │ │ │ ├── src │ │ │ │ └── lib.rs │ │ │ └── subdep-dir-name │ │ │ │ ├── Cargo.toml │ │ │ │ └── src │ │ │ │ └── lib.rs │ │ └── src │ │ │ └── main.rs │ │ ├── issue_3164 │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ │ └── workspaces │ │ └── path-dep-above │ │ ├── e │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ │ └── ws │ │ ├── Cargo.toml │ │ ├── a │ │ ├── Cargo.toml │ │ ├── d │ │ │ ├── Cargo.toml │ │ │ ├── f │ │ │ │ ├── Cargo.toml │ │ │ │ └── src │ │ │ │ │ └── lib.rs │ │ │ └── src │ │ │ │ └── lib.rs │ │ └── src │ │ │ └── main.rs │ │ ├── b │ │ ├── Cargo.toml │ │ └── src │ │ │ └── main.rs │ │ └── c │ │ ├── Cargo.toml │ │ └── src │ │ └── lib.rs ├── config │ ├── disable_all_formatting.toml │ ├── issue-1111.toml │ ├── issue-2641.toml │ ├── issue-3779.toml │ ├── issue-5801-v1.toml │ ├── issue-5801-v2.toml │ ├── issue-5816.toml │ ├── issue-6302.toml │ ├── skip_children.toml │ ├── small_tabs.toml │ └── style-edition │ │ ├── just-style-edition │ │ └── rustfmt.toml │ │ ├── just-version │ │ └── rustfmt.toml │ │ ├── overrides │ │ └── rustfmt.toml │ │ ├── style-edition-and-edition │ │ └── rustfmt.toml │ │ ├── version-edition │ │ └── rustfmt.toml │ │ ├── version-style-edition-and-edition │ │ └── rustfmt.toml │ │ └── version-style-edition │ │ └── rustfmt.toml ├── coverage │ ├── source │ │ └── comments.rs │ └── target │ │ └── comments.rs ├── mod-resolver │ ├── issue-4874 │ │ ├── bar │ │ │ └── baz.rs │ │ ├── foo.rs │ │ ├── foo │ │ │ └── qux.rs │ │ └── main.rs │ ├── issue-5063 │ │ ├── foo.rs │ │ ├── foo │ │ │ └── bar │ │ │ │ └── baz.rs │ │ └── main.rs │ ├── issue-5167 │ │ └── src │ │ │ ├── a.rs │ │ │ ├── a │ │ │ └── mod.rs │ │ │ └── lib.rs │ ├── issue-5198 │ │ ├── a.rs │ │ ├── lib.rs │ │ └── lib │ │ │ ├── b.rs │ │ │ ├── c │ │ │ ├── d.rs │ │ │ ├── d │ │ │ │ ├── explanation.txt │ │ │ │ ├── f.rs │ │ │ │ └── g │ │ │ │ │ └── mod.rs │ │ │ ├── e.rs │ │ │ └── mod.rs │ │ │ └── explanation.txt │ ├── module-not-found │ │ ├── bad_path_attribute │ │ │ └── lib.rs │ │ ├── relative_module │ │ │ ├── a.rs │ │ │ └── lib.rs │ │ └── sibling_module │ │ │ └── lib.rs │ ├── skip-files-issue-5065 │ │ ├── foo.rs │ │ ├── foo │ │ │ └── bar │ │ │ │ └── baz.rs │ │ ├── main.rs │ │ └── one.rs │ └── test-submodule-issue-5119 │ │ ├── Cargo.toml │ │ ├── src │ │ └── lib.rs │ │ └── tests │ │ ├── test1.rs │ │ └── test1 │ │ ├── sub1.rs │ │ ├── sub2.rs │ │ └── sub3 │ │ ├── mod.rs │ │ └── sub4.rs ├── parser │ ├── issue-4126 │ │ ├── invalid.rs │ │ └── lib.rs │ ├── issue_4418.rs │ ├── stashed-diag.rs │ ├── stashed-diag2.rs │ └── unclosed-delims │ │ └── issue_4466.rs ├── rustfmt │ └── main.rs ├── source │ ├── 5131_crate.rs │ ├── 5131_module.rs │ ├── 5131_one.rs │ ├── alignment_2633 │ │ ├── block_style.rs │ │ └── visual_style.rs │ ├── array_comment.rs │ ├── arrow_in_comments │ │ ├── arrow_in_single_comment.rs │ │ └── multiple_arrows.rs │ ├── assignment.rs │ ├── associated-types-bounds-wrapping.rs │ ├── associated_type_bounds.rs │ ├── async_block.rs │ ├── async_fn.rs │ ├── attrib.rs │ ├── big-impl-block.rs │ ├── big-impl-visual.rs │ ├── binary-expr.rs │ ├── binop-separator-back │ │ ├── bitwise.rs │ │ ├── comp.rs │ │ ├── logic.rs │ │ ├── math.rs │ │ ├── patterns.rs │ │ └── range.rs │ ├── break-and-continue.rs │ ├── catch.rs │ ├── cfg_if │ │ ├── detect │ │ │ ├── arch │ │ │ │ ├── aarch64.rs │ │ │ │ ├── arm.rs │ │ │ │ ├── mips.rs │ │ │ │ ├── mips64.rs │ │ │ │ ├── powerpc.rs │ │ │ │ ├── powerpc64.rs │ │ │ │ └── x86.rs │ │ │ ├── bit.rs │ │ │ ├── cache.rs │ │ │ ├── error_macros.rs │ │ │ ├── mod.rs │ │ │ └── os │ │ │ │ ├── aarch64.rs │ │ │ │ ├── freebsd │ │ │ │ ├── aarch64.rs │ │ │ │ ├── arm.rs │ │ │ │ ├── auxvec.rs │ │ │ │ ├── mod.rs │ │ │ │ └── powerpc.rs │ │ │ │ ├── linux │ │ │ │ ├── aarch64.rs │ │ │ │ ├── arm.rs │ │ │ │ ├── auxvec.rs │ │ │ │ ├── cpuinfo.rs │ │ │ │ ├── mips.rs │ │ │ │ ├── mod.rs │ │ │ │ └── powerpc.rs │ │ │ │ ├── other.rs │ │ │ │ └── x86.rs │ │ ├── lib.rs │ │ └── mod.rs │ ├── cfg_match │ │ ├── format_me_please_1.rs │ │ ├── format_me_please_2.rs │ │ ├── format_me_please_3.rs │ │ ├── format_me_please_4.rs │ │ ├── lib.rs │ │ └── lib2.rs │ ├── cfg_mod │ │ ├── bar.rs │ │ ├── dir │ │ │ └── dir1 │ │ │ │ ├── dir2 │ │ │ │ └── wasm32.rs │ │ │ │ └── dir3 │ │ │ │ └── wasm32.rs │ │ ├── foo.rs │ │ ├── mod.rs │ │ ├── other.rs │ │ └── wasm32.rs │ ├── chains-visual.rs │ ├── chains.rs │ ├── chains_with_comment.rs │ ├── closure-block-inside-macro.rs │ ├── closure-block-labels.rs │ ├── closure.rs │ ├── comment.rs │ ├── comment2.rs │ ├── comment3.rs │ ├── comment4.rs │ ├── comment5.rs │ ├── comment6.rs │ ├── comment_crlf_newline.rs │ ├── comments-in-lists │ │ ├── wrap-comments-not-normalized.rs │ │ └── wrap-comments-true.rs │ ├── comments_unicode.rs │ ├── configs │ │ ├── blank_lines_lower_bound │ │ │ └── 1.rs │ │ ├── brace_style │ │ │ ├── fn_always_next_line.rs │ │ │ ├── fn_prefer_same_line.rs │ │ │ ├── fn_same_line_where.rs │ │ │ ├── item_always_next_line.rs │ │ │ ├── item_prefer_same_line.rs │ │ │ └── item_same_line_where.rs │ │ ├── chain_width │ │ │ ├── always.rs │ │ │ ├── small.rs │ │ │ └── tiny.rs │ │ ├── comment_width │ │ │ ├── above.rs │ │ │ ├── below.rs │ │ │ └── ignore.rs │ │ ├── condense_wildcard_suffixes │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── control_brace_style │ │ │ ├── always_next_line.rs │ │ │ ├── always_same_line.rs │ │ │ └── closing_next_line.rs │ │ ├── disable_all_formatting │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── doc_comment_code_block_width │ │ │ ├── 100.rs │ │ │ ├── 100_greater_max_width.rs │ │ │ └── 50.rs │ │ ├── empty_item_single_line │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── enum_discrim_align_threshold │ │ │ └── 40.rs │ │ ├── error_on_line_overflow │ │ │ └── false.rs │ │ ├── float_literal_trailing_zero │ │ │ ├── always.rs │ │ │ ├── if-no-postfix.rs │ │ │ └── never.rs │ │ ├── fn_params_layout │ │ │ ├── compressed.rs │ │ │ ├── tall.rs │ │ │ └── vertical.rs │ │ ├── fn_single_line │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── force_explicit_abi │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── force_multiline_block │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── format_generated_files │ │ │ ├── false.rs │ │ │ ├── false_with_generated_marker_line_search_limit.rs │ │ │ ├── false_with_marker_out_scope_size.rs │ │ │ ├── false_with_zero_search_limit.rs │ │ │ ├── true.rs │ │ │ ├── true_with_marker_in_scope_size.rs │ │ │ └── true_with_marker_not_in_header.rs │ │ ├── format_macro_bodies │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── format_macro_matchers │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── format_strings │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── group_imports │ │ │ ├── One-merge_imports.rs │ │ │ ├── One-nested.rs │ │ │ ├── One-no_reorder.rs │ │ │ ├── One.rs │ │ │ ├── StdExternalCrate-merge_imports.rs │ │ │ ├── StdExternalCrate-nested.rs │ │ │ ├── StdExternalCrate-no_reorder.rs │ │ │ ├── StdExternalCrate-non_consecutive.rs │ │ │ └── StdExternalCrate.rs │ │ ├── hard_tabs │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── imports_layout │ │ │ └── merge_mixed.rs │ │ ├── indent_style │ │ │ ├── block_args.rs │ │ │ ├── block_array.rs │ │ │ ├── block_call.rs │ │ │ ├── block_chain.rs │ │ │ ├── block_generic.rs │ │ │ ├── block_struct_lit.rs │ │ │ ├── block_trailing_comma_call │ │ │ │ ├── one.rs │ │ │ │ └── two.rs │ │ │ ├── block_where_pred.rs │ │ │ ├── default.rs │ │ │ ├── rfc_where.rs │ │ │ ├── visual_args.rs │ │ │ ├── visual_array.rs │ │ │ ├── visual_call.rs │ │ │ ├── visual_chain.rs │ │ │ ├── visual_generics.rs │ │ │ ├── visual_struct_lit.rs │ │ │ ├── visual_trailing_comma.rs │ │ │ └── visual_where_pred.rs │ │ ├── match_arm_blocks │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── match_arm_indent │ │ │ ├── attrs.rs │ │ │ ├── guards.rs │ │ │ ├── leading_pipes.rs │ │ │ ├── nested.rs │ │ │ ├── patterns.rs │ │ │ └── unindent.rs │ │ ├── match_arm_leading_pipes │ │ │ ├── always.rs │ │ │ ├── never.rs │ │ │ └── preserve.rs │ │ ├── match_block_trailing_comma │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── merge_derives │ │ │ └── true.rs │ │ ├── normalize_comments │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── normalize_doc_attributes │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── remove_nested_parens │ │ │ └── remove_nested_parens.rs │ │ ├── reorder_impl_items │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── reorder_imports │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── reorder_modules │ │ │ ├── dolor │ │ │ │ └── mod.rs │ │ │ ├── false.rs │ │ │ ├── ipsum │ │ │ │ └── mod.rs │ │ │ ├── lorem │ │ │ │ └── mod.rs │ │ │ ├── sit │ │ │ │ └── mod.rs │ │ │ └── true.rs │ │ ├── short_array_element_width_threshold │ │ │ ├── 10.rs │ │ │ ├── 20.rs │ │ │ └── greater_than_max_width.rs │ │ ├── single_line_let_else_max_width │ │ │ ├── 100.rs │ │ │ ├── 50.rs │ │ │ └── zero.rs │ │ ├── skip_children │ │ │ ├── foo │ │ │ │ └── mod.rs │ │ │ └── true.rs │ │ ├── space_before_colon │ │ │ └── true.rs │ │ ├── spaces_around_ranges │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── struct_field_align_threshold │ │ │ └── 20.rs │ │ ├── struct_lit_single_line │ │ │ └── false.rs │ │ ├── style_edition │ │ │ ├── overflow_delim_expr_2015.rs │ │ │ └── overflow_delim_expr_2024.rs │ │ ├── tab_spaces │ │ │ ├── 2.rs │ │ │ └── 4.rs │ │ ├── trailing_comma │ │ │ ├── always.rs │ │ │ ├── never.rs │ │ │ └── vertical.rs │ │ ├── type_punctuation_density │ │ │ ├── compressed.rs │ │ │ └── wide.rs │ │ ├── use_field_init_shorthand │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── use_small_heuristics │ │ │ ├── default.rs │ │ │ ├── max.rs │ │ │ └── off.rs │ │ ├── use_try_shorthand │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── where_single_line │ │ │ └── true.rs │ │ └── wrap_comments │ │ │ ├── false.rs │ │ │ └── true.rs │ ├── const_generics.rs │ ├── control-brace-style-always-next-line.rs │ ├── control-brace-style-always-same-line.rs │ ├── default-field-values.rs │ ├── doc-attrib.rs │ ├── doc-comment-with-example.rs │ ├── doc.rs │ ├── dyn_trait.rs │ ├── else-if-brace-style-always-next-line.rs │ ├── else-if-brace-style-always-same-line.rs │ ├── else-if-brace-style-closing-next-line.rs │ ├── empty-item-single-line-false.rs │ ├── empty_file.rs │ ├── enum.rs │ ├── ergonomic_clones.rs │ ├── existential_type.rs │ ├── expr-block.rs │ ├── expr-overflow-delimited.rs │ ├── expr.rs │ ├── extern.rs │ ├── extern_not_explicit.rs │ ├── file-lines-1.rs │ ├── file-lines-2.rs │ ├── file-lines-3.rs │ ├── file-lines-4.rs │ ├── file-lines-5.rs │ ├── file-lines-6.rs │ ├── file-lines-7.rs │ ├── file-lines-item.rs │ ├── fn-custom-2.rs │ ├── fn-custom-3.rs │ ├── fn-custom-4.rs │ ├── fn-custom-6.rs │ ├── fn-custom-7.rs │ ├── fn-custom-8.rs │ ├── fn-custom.rs │ ├── fn-param-attributes.rs │ ├── fn-simple.rs │ ├── fn-single-line │ │ ├── version_one.rs │ │ └── version_two.rs │ ├── fn_args_indent-block.rs │ ├── fn_args_layout-vertical.rs │ ├── hard-tabs.rs │ ├── hello.rs │ ├── hello2.rs │ ├── hex_literal_lower.rs │ ├── hex_literal_upper.rs │ ├── if_while_or_patterns.rs │ ├── immovable_coroutines.rs │ ├── impls.rs │ ├── imports │ │ ├── imports-impl-only-use.rs │ │ ├── imports-reorder-lines-and-items.rs │ │ ├── imports-reorder-lines.rs │ │ ├── imports-reorder.rs │ │ ├── imports.rs │ │ ├── imports_block_indent.rs │ │ ├── imports_granularity_crate.rs │ │ ├── imports_granularity_default-with-dups.rs │ │ ├── imports_granularity_item-with-dups-StdExternalCrate-no-reorder.rs │ │ ├── imports_granularity_item-with-dups.rs │ │ ├── imports_granularity_item.rs │ │ └── imports_granularity_module.rs │ ├── imports_granularity_one.rs │ ├── imports_raw_identifiers │ │ ├── version_One.rs │ │ └── version_Two.rs │ ├── invalid-rust-code-in-doc-comment.rs │ ├── issue-1021.rs │ ├── issue-1049.rs │ ├── issue-1111.rs │ ├── issue-1120.rs │ ├── issue-1124.rs │ ├── issue-1127.rs │ ├── issue-1158.rs │ ├── issue-1177.rs │ ├── issue-1192.rs │ ├── issue-1210 │ │ ├── a.rs │ │ ├── b.rs │ │ ├── c.rs │ │ ├── d.rs │ │ └── e.rs │ ├── issue-1211.rs │ ├── issue-1216.rs │ ├── issue-1239.rs │ ├── issue-1278.rs │ ├── issue-1350.rs │ ├── issue-1366.rs │ ├── issue-1468.rs │ ├── issue-1693.rs │ ├── issue-1800.rs │ ├── issue-1914.rs │ ├── issue-2025.rs │ ├── issue-2111.rs │ ├── issue-2164.rs │ ├── issue-2179 │ │ ├── one.rs │ │ └── two.rs │ ├── issue-2256.rs │ ├── issue-2342.rs │ ├── issue-2445.rs │ ├── issue-2446.rs │ ├── issue-2479.rs │ ├── issue-2482 │ │ ├── a.rs │ │ ├── b.rs │ │ └── c.rs │ ├── issue-2496.rs │ ├── issue-2520.rs │ ├── issue-2523.rs │ ├── issue-2582.rs │ ├── issue-2641.rs │ ├── issue-2644.rs │ ├── issue-2728.rs │ ├── issue-2761.rs │ ├── issue-2781.rs │ ├── issue-2794.rs │ ├── issue-2835.rs │ ├── issue-2863.rs │ ├── issue-2869.rs │ ├── issue-2896.rs │ ├── issue-2916.rs │ ├── issue-2917 │ │ └── packed_simd.rs │ ├── issue-2922.rs │ ├── issue-2927-2.rs │ ├── issue-2927.rs │ ├── issue-2930.rs │ ├── issue-2936.rs │ ├── issue-2955.rs │ ├── issue-2973.rs │ ├── issue-2977 │ │ ├── impl.rs │ │ └── trait.rs │ ├── issue-2985.rs │ ├── issue-2995.rs │ ├── issue-3029.rs │ ├── issue-3038.rs │ ├── issue-3049.rs │ ├── issue-3055 │ │ └── original.rs │ ├── issue-3059.rs │ ├── issue-3066.rs │ ├── issue-3131.rs │ ├── issue-3153.rs │ ├── issue-3158.rs │ ├── issue-3194.rs │ ├── issue-3198.rs │ ├── issue-3213 │ │ ├── version_one.rs │ │ └── version_two.rs │ ├── issue-3217.rs │ ├── issue-3227 │ │ └── two.rs │ ├── issue-3234.rs │ ├── issue-3241.rs │ ├── issue-3253 │ │ ├── bar.rs │ │ ├── foo.rs │ │ ├── lib.rs │ │ └── paths │ │ │ ├── bar_foo.rs │ │ │ ├── excluded.rs │ │ │ └── foo_bar.rs │ ├── issue-3265.rs │ ├── issue-3270 │ │ ├── one.rs │ │ └── two.rs │ ├── issue-3272 │ │ ├── v1.rs │ │ └── v2.rs │ ├── issue-3278 │ │ ├── style_edition_2015.rs │ │ ├── style_edition_2024.rs │ │ └── style_edition_2027.rs │ ├── issue-3295 │ │ └── two.rs │ ├── issue-3302.rs │ ├── issue-3343.rs │ ├── issue-3423.rs │ ├── issue-3434 │ │ ├── lib.rs │ │ ├── no_entry.rs │ │ └── not_skip_macro.rs │ ├── issue-3465.rs │ ├── issue-3494 │ │ ├── crlf.rs │ │ └── lf.rs │ ├── issue-3508.rs │ ├── issue-3515.rs │ ├── issue-3532.rs │ ├── issue-3585 │ │ ├── extern_crate.rs │ │ ├── reorder_imports_disabled.rs │ │ ├── reorder_imports_enabled.rs │ │ └── use.rs │ ├── issue-3636.rs │ ├── issue-3639.rs │ ├── issue-3651.rs │ ├── issue-3665 │ │ ├── lib.rs │ │ ├── not_skip_attribute.rs │ │ └── sub_mod.rs │ ├── issue-3672.rs │ ├── issue-3675.rs │ ├── issue-3701 │ │ ├── one.rs │ │ └── two.rs │ ├── issue-3709.rs │ ├── issue-3740.rs │ ├── issue-3750.rs │ ├── issue-3751.rs │ ├── issue-3779 │ │ ├── ice.rs │ │ └── lib.rs │ ├── issue-3786.rs │ ├── issue-3787.rs │ ├── issue-3805.rs │ ├── issue-3840 │ │ ├── version-one_hard-tabs.rs │ │ ├── version-one_soft-tabs.rs │ │ ├── version-two_hard-tabs.rs │ │ └── version-two_soft-tabs.rs │ ├── issue-3984.rs │ ├── issue-3987 │ │ └── format_macro_bodies_true.rs │ ├── issue-4018.rs │ ├── issue-4036 │ │ ├── one.rs │ │ ├── three.rs │ │ └── two.rs │ ├── issue-4041.rs │ ├── issue-4079.rs │ ├── issue-4120.rs │ ├── issue-4243.rs │ ├── issue-4244.rs │ ├── issue-4245.rs │ ├── issue-4312.rs │ ├── issue-4381 │ │ └── style_edition_2015.rs │ ├── issue-4382.rs │ ├── issue-4398.rs │ ├── issue-4427.rs │ ├── issue-447.rs │ ├── issue-4530.rs │ ├── issue-4577.rs │ ├── issue-4603.rs │ ├── issue-4615 │ │ └── minimum_example.rs │ ├── issue-4643.rs │ ├── issue-4646.rs │ ├── issue-4656 │ │ ├── format_me_please.rs │ │ ├── lib.rs │ │ └── lib2.rs │ ├── issue-4689 │ │ ├── one.rs │ │ └── two.rs │ ├── issue-4791 │ │ ├── buggy.rs │ │ └── trailing_comma.rs │ ├── issue-4808.rs │ ├── issue-4816 │ │ └── lib.rs │ ├── issue-4926 │ │ ├── deeply_nested_struct.rs │ │ ├── deeply_nested_struct_with_long_field_names.rs │ │ ├── deeply_nested_struct_with_many_fields.rs │ │ ├── enum_struct_field.rs │ │ ├── minimum_example.rs │ │ ├── struct_with_long_field_names.rs │ │ └── struct_with_many_fields.rs │ ├── issue-4984 │ │ ├── minimum_example.rs │ │ ├── multi_line_derive.rs │ │ └── multiple_comments_within.rs │ ├── issue-5011.rs │ ├── issue-5023.rs │ ├── issue-5030.rs │ ├── issue-5042 │ │ ├── multi-line_comment_with_trailing_comma.rs │ │ ├── multi-line_comment_without_trailing_comma.rs │ │ ├── single-line_comment_with_trailing_comma.rs │ │ └── single-line_comment_without_trailing_comma.rs │ ├── issue-5088 │ │ ├── deeply_nested_long_comment_wrap_comments_true.rs │ │ ├── start_with_empty_comment_very_long_itemized_block_wrap_comments_true.rs │ │ └── very_long_comment_wrap_comments_true.rs │ ├── issue-510.rs │ ├── issue-5157 │ │ ├── indented_itemized_markdown_blockquote.rs │ │ ├── nested_itemized_markdown_blockquote.rs │ │ └── support_itemized_markdown_blockquote.rs │ ├── issue-5234.rs │ ├── issue-5238 │ │ ├── markdown_header_wrap_comments_false.rs │ │ └── markdown_header_wrap_comments_true.rs │ ├── issue-5260.rs │ ├── issue-5270 │ │ └── merge_derives_true.rs │ ├── issue-539.rs │ ├── issue-5488.rs │ ├── issue-5586.rs │ ├── issue-5655 │ │ ├── one.rs │ │ └── two.rs │ ├── issue-5791.rs │ ├── issue-5801 │ │ ├── attribute_unexpectedly_wraps_before_max_width.rs │ │ └── comment_unexpectedly_wraps_before_max_width.rs │ ├── issue-5835.rs │ ├── issue-5852 │ │ ├── default.rs │ │ ├── horizontal.rs │ │ ├── horizontal_vertical.rs │ │ ├── issue_example.rs │ │ ├── split.rs │ │ └── vertical.rs │ ├── issue-5935.rs │ ├── issue-5987 │ │ └── two.rs │ ├── issue-6059 │ │ └── repro.rs │ ├── issue-6147 │ │ ├── case_rustfmt_v1.rs │ │ └── case_rustfmt_v2.rs │ ├── issue-6202 │ │ └── long_pat.rs │ ├── issue-6333.rs │ ├── issue-683.rs │ ├── issue-811.rs │ ├── issue-850.rs │ ├── issue-855.rs │ ├── issue-913.rs │ ├── issue-945.rs │ ├── issue-977.rs │ ├── issue_1306.rs │ ├── issue_3245.rs │ ├── issue_3561.rs │ ├── issue_3839.rs │ ├── issue_3844.rs │ ├── issue_3853.rs │ ├── issue_3868.rs │ ├── issue_4032.rs │ ├── issue_4057.rs │ ├── issue_4086.rs │ ├── issue_4257.rs │ ├── issue_4322.rs │ ├── issue_4374.rs │ ├── issue_4475.rs │ ├── issue_4528.rs │ ├── issue_4579.rs │ ├── issue_4584.rs │ ├── issue_4636.rs │ ├── issue_4675.rs │ ├── issue_4823.rs │ ├── issue_4854.rs │ ├── issue_4911.rs │ ├── issue_4943.rs │ ├── issue_4954.rs │ ├── issue_4963.rs │ ├── issue_5027.rs │ ├── issue_5086.rs │ ├── issue_5686.rs │ ├── issue_5721.rs │ ├── issue_5730.rs │ ├── issue_5735.rs │ ├── issue_5882.rs │ ├── issue_5912.rs │ ├── item-brace-style-always-next-line.rs │ ├── item-brace-style-prefer-same-line.rs │ ├── item-brace-style-same-line-where.rs │ ├── itemized-blocks │ │ ├── no_wrap.rs │ │ ├── rewrite_fail.rs │ │ ├── urls.rs │ │ └── wrap.rs │ ├── label_break.rs │ ├── large-block.rs │ ├── large_vec.rs │ ├── lazy_static.rs │ ├── let_chains.rs │ ├── let_else.rs │ ├── let_else_v2.rs │ ├── long-fn-1 │ │ ├── style_edition_2015.rs │ │ ├── style_edition_2024.rs │ │ └── style_edition_2027.rs │ ├── long-match-arms-brace-newline.rs │ ├── long-use-statement-issue-3154.rs │ ├── long_field_access.rs │ ├── loop.rs │ ├── macro_not_expr.rs │ ├── macro_rules.rs │ ├── macros.rs │ ├── macros │ │ └── rewrite-const-item.rs │ ├── markdown-comment-with-options.rs │ ├── markdown-comment.rs │ ├── match-block-trailing-comma.rs │ ├── match-flattening.rs │ ├── match-nowrap-trailing-comma.rs │ ├── match-nowrap.rs │ ├── match.rs │ ├── match_overflow_expr.rs │ ├── max-line-length-in-chars.rs │ ├── merge_imports_true_compat.rs │ ├── mod-1.rs │ ├── mod-2.rs │ ├── mod_skip_child.rs │ ├── multiple.rs │ ├── mut_ref.rs │ ├── negative-impl.rs │ ├── nested-if-else.rs │ ├── nested_skipped │ │ └── mod.rs │ ├── nestedmod │ │ ├── mod.rs │ │ ├── mod2a.rs │ │ ├── mod2b.rs │ │ ├── mod2c.rs │ │ ├── mymod1 │ │ │ └── mod3a.rs │ │ └── submod2 │ │ │ ├── a.rs │ │ │ └── mod.rs │ ├── no_arg_with_comment.rs │ ├── no_new_line_beginning.rs │ ├── non-lifetime-binders.rs │ ├── non_ascii_numerics_import_asciibetically.rs │ ├── non_ascii_numerics_import_versionsort.rs │ ├── normalize_doc_attributes_should_not_imply_format_doc_comments.rs │ ├── normalize_multiline_doc_attribute.rs │ ├── one_line_if_v1.rs │ ├── one_line_if_v2.rs │ ├── other.rs │ ├── paren.rs │ ├── path_clarity │ │ ├── foo.rs │ │ └── foo │ │ │ └── bar.rs │ ├── paths.rs │ ├── pattern-condense-wildcards.rs │ ├── pattern.rs │ ├── pin_sugar.rs │ ├── postfix-match │ │ └── pf-match.rs │ ├── precise-capturing.rs │ ├── preserves_carriage_return_for_unix.rs │ ├── preserves_carriage_return_for_windows.rs │ ├── pub-restricted.rs │ ├── remove_blank_lines.rs │ ├── reorder-impl-items.rs │ ├── reorder_modules │ │ ├── A2 │ │ │ └── mod.rs │ │ ├── ABCD │ │ │ └── mod.rs │ │ ├── ZYXW │ │ │ └── mod.rs │ │ ├── ZYXW_ │ │ │ └── mod.rs │ │ ├── ZY_XW │ │ │ └── mod.rs │ │ ├── Z_YXW │ │ │ └── mod.rs │ │ ├── _ZYXW │ │ │ └── mod.rs │ │ ├── _abcd │ │ │ └── mod.rs │ │ ├── a1 │ │ │ └── mod.rs │ │ ├── abcd │ │ │ └── mod.rs │ │ ├── disabled_style_edition_2024.rs │ │ ├── enabled_style_edition_2015.rs │ │ ├── enabled_style_edition_2024.rs │ │ ├── u128 │ │ │ └── mod.rs │ │ ├── u16 │ │ │ └── mod.rs │ │ ├── u256 │ │ │ └── mod.rs │ │ ├── u32 │ │ │ └── mod.rs │ │ ├── u64 │ │ │ └── mod.rs │ │ ├── u8 │ │ │ └── mod.rs │ │ ├── u_zzz │ │ │ └── mod.rs │ │ ├── ua │ │ │ └── mod.rs │ │ ├── usize │ │ │ └── mod.rs │ │ ├── uz │ │ │ └── mod.rs │ │ ├── v0 │ │ │ └── mod.rs │ │ ├── v00 │ │ │ └── mod.rs │ │ ├── v000 │ │ │ └── mod.rs │ │ ├── v001 │ │ │ └── mod.rs │ │ ├── v009 │ │ │ └── mod.rs │ │ ├── v00t │ │ │ └── mod.rs │ │ ├── v01 │ │ │ └── mod.rs │ │ ├── v010 │ │ │ └── mod.rs │ │ ├── v09 │ │ │ └── mod.rs │ │ ├── v0s │ │ │ └── mod.rs │ │ ├── v0u │ │ │ └── mod.rs │ │ ├── v1 │ │ │ └── mod.rs │ │ ├── v10 │ │ │ └── mod.rs │ │ ├── v9 │ │ │ └── mod.rs │ │ ├── w005s09t │ │ │ └── mod.rs │ │ ├── w5s009t │ │ │ └── mod.rs │ │ ├── x64 │ │ │ └── mod.rs │ │ ├── x86 │ │ │ └── mod.rs │ │ ├── x86_128 │ │ │ └── mod.rs │ │ ├── x86_32 │ │ │ └── mod.rs │ │ ├── x86_64 │ │ │ └── mod.rs │ │ ├── x87 │ │ │ └── mod.rs │ │ └── zyxw │ │ │ └── mod.rs │ ├── single-line-if-else.rs │ ├── single-line-macro │ │ ├── v1.rs │ │ └── v2.rs │ ├── skip_macro_invocations │ │ ├── all.rs │ │ ├── all_and_name.rs │ │ ├── config_file.rs │ │ ├── empty.rs │ │ ├── name.rs │ │ ├── name_unknown.rs │ │ ├── names.rs │ │ ├── path_qualified_invocation_mismatch.rs │ │ ├── path_qualified_match.rs │ │ ├── path_qualified_name_mismatch.rs │ │ └── use_alias_examples.rs │ ├── soft-wrapping.rs │ ├── space-not-before-newline.rs │ ├── spaces-around-ranges.rs │ ├── statements.rs │ ├── static.rs │ ├── string-lit-2.rs │ ├── string-lit.rs │ ├── string_punctuation.rs │ ├── struct-field-attributes.rs │ ├── struct_field_doc_comment.rs │ ├── struct_lits.rs │ ├── struct_lits_multiline.rs │ ├── struct_lits_visual.rs │ ├── struct_lits_visual_multiline.rs │ ├── struct_tuple_visual.rs │ ├── structs.rs │ ├── trailing-comma-never.rs │ ├── trailing_commas.rs │ ├── trailing_comments │ │ ├── hard_tabs.rs │ │ └── soft_tabs.rs │ ├── trait.rs │ ├── try-conversion.rs │ ├── try_block.rs │ ├── tuple.rs │ ├── tuple_v2.rs │ ├── type-alias-where-clauses-with-comments.rs │ ├── type-alias-where-clauses.rs │ ├── type.rs │ ├── type_alias.rs │ ├── unicode.rs │ ├── unions.rs │ ├── unsafe-binders.rs │ ├── unsafe-field.rs │ ├── unsafe-mod.rs │ ├── visibility.rs │ ├── visual-fn-type.rs │ ├── where-clause-rfc.rs │ ├── where-clause.rs │ ├── width-heuristics.rs │ └── wrap_comments_should_not_imply_format_doc_comments.rs ├── target │ ├── 5131_crate.rs │ ├── 5131_module.rs │ ├── 5131_one.rs │ ├── alignment_2633 │ │ ├── block_style.rs │ │ ├── horizontal_tactic.rs │ │ └── visual_style.rs │ ├── array_comment.rs │ ├── arrow_in_comments │ │ ├── arrow_in_single_comment.rs │ │ └── multiple_arrows.rs │ ├── assignment.rs │ ├── associated-items.rs │ ├── associated-types-bounds-wrapping.rs │ ├── associated_type_bounds.rs │ ├── associated_type_defaults.rs │ ├── async_block.rs │ ├── async_closure.rs │ ├── async_fn.rs │ ├── asyncness.rs │ ├── attrib-block-expr.rs │ ├── attrib-extern-crate.rs │ ├── attrib.rs │ ├── big-impl-block.rs │ ├── big-impl-visual.rs │ ├── binary-expr.rs │ ├── binop-separator-back │ │ ├── bitwise.rs │ │ ├── comp.rs │ │ ├── logic.rs │ │ ├── math.rs │ │ ├── patterns.rs │ │ └── range.rs │ ├── break-and-continue.rs │ ├── catch.rs │ ├── cfg_attribute_in_where.rs │ ├── cfg_if │ │ ├── detect │ │ │ ├── arch │ │ │ │ ├── aarch64.rs │ │ │ │ ├── arm.rs │ │ │ │ ├── mips.rs │ │ │ │ ├── mips64.rs │ │ │ │ ├── powerpc.rs │ │ │ │ ├── powerpc64.rs │ │ │ │ └── x86.rs │ │ │ ├── bit.rs │ │ │ ├── cache.rs │ │ │ ├── error_macros.rs │ │ │ ├── mod.rs │ │ │ └── os │ │ │ │ ├── aarch64.rs │ │ │ │ ├── freebsd │ │ │ │ ├── aarch64.rs │ │ │ │ ├── arm.rs │ │ │ │ ├── auxvec.rs │ │ │ │ ├── mod.rs │ │ │ │ └── powerpc.rs │ │ │ │ ├── linux │ │ │ │ ├── aarch64.rs │ │ │ │ ├── arm.rs │ │ │ │ ├── auxvec.rs │ │ │ │ ├── cpuinfo.rs │ │ │ │ ├── mips.rs │ │ │ │ ├── mod.rs │ │ │ │ └── powerpc.rs │ │ │ │ ├── other.rs │ │ │ │ └── x86.rs │ │ ├── lib.rs │ │ └── mod.rs │ ├── cfg_match │ │ ├── format_me_please_1.rs │ │ ├── format_me_please_2.rs │ │ ├── format_me_please_3.rs │ │ ├── format_me_please_4.rs │ │ ├── lib.rs │ │ └── lib2.rs │ ├── cfg_mod │ │ ├── bar.rs │ │ ├── dir │ │ │ └── dir1 │ │ │ │ ├── dir2 │ │ │ │ └── wasm32.rs │ │ │ │ └── dir3 │ │ │ │ └── wasm32.rs │ │ ├── foo.rs │ │ ├── mod.rs │ │ ├── other.rs │ │ └── wasm32.rs │ ├── chains-visual.rs │ ├── chains.rs │ ├── chains_with_comment.rs │ ├── closure-block-inside-macro.rs │ ├── closure-block-labels.rs │ ├── closure.rs │ ├── comment-inside-const.rs │ ├── comment-not-disappear.rs │ ├── comment.rs │ ├── comment2.rs │ ├── comment3.rs │ ├── comment4.rs │ ├── comment5.rs │ ├── comment6.rs │ ├── comment_crlf_newline.rs │ ├── comments-fn.rs │ ├── comments-in-lists │ │ ├── format-doc-comments.rs │ │ ├── wrap-comments-false.rs │ │ ├── wrap-comments-not-normalized.rs │ │ └── wrap-comments-true.rs │ ├── comments_unicode.rs │ ├── configs │ │ ├── blank_lines_lower_bound │ │ │ └── 1.rs │ │ ├── brace_style │ │ │ ├── fn_always_next_line.rs │ │ │ ├── fn_prefer_same_line.rs │ │ │ ├── fn_same_line_where.rs │ │ │ ├── item_always_next_line.rs │ │ │ ├── item_prefer_same_line.rs │ │ │ └── item_same_line_where.rs │ │ ├── chain_width │ │ │ ├── always.rs │ │ │ ├── small.rs │ │ │ └── tiny.rs │ │ ├── combine_control_expr │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── comment_width │ │ │ ├── above.rs │ │ │ ├── below.rs │ │ │ └── ignore.rs │ │ ├── condense_wildcard_suffixes │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── control_brace_style │ │ │ ├── always_next_line.rs │ │ │ ├── always_same_line.rs │ │ │ └── closing_next_line.rs │ │ ├── disable_all_formatting │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── doc_comment_code_block_width │ │ │ ├── 100.rs │ │ │ ├── 100_greater_max_width.rs │ │ │ └── 50.rs │ │ ├── empty_item_single_line │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── enum_discrim_align_threshold │ │ │ └── 40.rs │ │ ├── error_on_line_overflow │ │ │ └── false.rs │ │ ├── error_on_unformatted │ │ │ └── false.rs │ │ ├── float_literal_trailing_zero │ │ │ ├── always.rs │ │ │ ├── if-no-postfix.rs │ │ │ ├── never.rs │ │ │ └── preserve.rs │ │ ├── fn_params_layout │ │ │ ├── compressed.rs │ │ │ ├── tall.rs │ │ │ └── vertical.rs │ │ ├── fn_single_line │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── force_explicit_abi │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── force_multiline_block │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── format_generated_files │ │ │ ├── false.rs │ │ │ ├── false_with_generated_marker_line_search_limit.rs │ │ │ ├── false_with_marker_out_scope_size.rs │ │ │ ├── false_with_zero_search_limit.rs │ │ │ ├── true.rs │ │ │ ├── true_with_marker_in_scope_size.rs │ │ │ └── true_with_marker_not_in_header.rs │ │ ├── format_macro_bodies │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── format_macro_matchers │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── format_strings │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── group_imports │ │ │ ├── One-merge_imports.rs │ │ │ ├── One-nested.rs │ │ │ ├── One-no_reorder.rs │ │ │ ├── One.rs │ │ │ ├── StdExternalCrate-merge_imports.rs │ │ │ ├── StdExternalCrate-nested.rs │ │ │ ├── StdExternalCrate-no_reorder.rs │ │ │ ├── StdExternalCrate-non_consecutive.rs │ │ │ └── StdExternalCrate.rs │ │ ├── hard_tabs │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── imports_indent │ │ │ └── block.rs │ │ ├── imports_layout │ │ │ ├── horizontal_vertical.rs │ │ │ ├── merge_mixed.rs │ │ │ └── mixed.rs │ │ ├── indent_style │ │ │ ├── block_args.rs │ │ │ ├── block_array.rs │ │ │ ├── block_call.rs │ │ │ ├── block_chain.rs │ │ │ ├── block_generic.rs │ │ │ ├── block_struct_lit.rs │ │ │ ├── block_tab_spaces_call.rs │ │ │ ├── block_trailing_comma_call │ │ │ │ ├── one.rs │ │ │ │ └── two.rs │ │ │ ├── block_where_pred.rs │ │ │ ├── default.rs │ │ │ ├── rfc_control.rs │ │ │ ├── rfc_where.rs │ │ │ ├── visual_args.rs │ │ │ ├── visual_array.rs │ │ │ ├── visual_call.rs │ │ │ ├── visual_chain.rs │ │ │ ├── visual_generics.rs │ │ │ ├── visual_struct_lit.rs │ │ │ ├── visual_trailing_comma.rs │ │ │ └── visual_where_pred.rs │ │ ├── match_arm_blocks │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── match_arm_indent │ │ │ ├── attrs.rs │ │ │ ├── guards.rs │ │ │ ├── leading_pipes.rs │ │ │ ├── nested.rs │ │ │ ├── noindent-tabs.rs │ │ │ ├── noindent.rs │ │ │ ├── patterns.rs │ │ │ └── unindent.rs │ │ ├── match_arm_leading_pipes │ │ │ ├── always.rs │ │ │ ├── never.rs │ │ │ └── preserve.rs │ │ ├── match_block_trailing_comma │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── merge_derives │ │ │ └── true.rs │ │ ├── normalize_comments │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── normalize_doc_attributes │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── remove_nested_parens │ │ │ └── remove_nested_parens.rs │ │ ├── reorder_impl_items │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── reorder_imports │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── reorder_modules │ │ │ ├── dolor │ │ │ │ └── mod.rs │ │ │ ├── false.rs │ │ │ ├── ipsum │ │ │ │ └── mod.rs │ │ │ ├── lorem │ │ │ │ └── mod.rs │ │ │ ├── sit │ │ │ │ └── mod.rs │ │ │ └── true.rs │ │ ├── short_array_element_width_threshold │ │ │ ├── 10.rs │ │ │ ├── 20.rs │ │ │ └── greater_than_max_width.rs │ │ ├── single_line_let_else_max_width │ │ │ ├── 100.rs │ │ │ ├── 50.rs │ │ │ └── zero.rs │ │ ├── skip_children │ │ │ ├── foo │ │ │ │ └── mod.rs │ │ │ └── true.rs │ │ ├── space_before_colon │ │ │ └── true.rs │ │ ├── spaces_around_ranges │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── struct_field_align_threshold │ │ │ └── 20.rs │ │ ├── struct_lit_single_line │ │ │ └── false.rs │ │ ├── style_edition │ │ │ ├── overflow_delim_expr_2015.rs │ │ │ └── overflow_delim_expr_2024.rs │ │ ├── tab_spaces │ │ │ ├── 2.rs │ │ │ └── 4.rs │ │ ├── trailing_comma │ │ │ ├── always.rs │ │ │ ├── never.rs │ │ │ └── vertical.rs │ │ ├── trailing_semicolon │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── type_punctuation_density │ │ │ ├── compressed.rs │ │ │ └── wide.rs │ │ ├── use_field_init_shorthand │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── use_small_heuristics │ │ │ ├── default.rs │ │ │ ├── max.rs │ │ │ └── off.rs │ │ ├── use_try_shorthand │ │ │ ├── false.rs │ │ │ └── true.rs │ │ ├── version │ │ │ └── mapped.rs │ │ ├── where_single_line │ │ │ ├── true-with-brace-style.rs │ │ │ └── true.rs │ │ └── wrap_comments │ │ │ ├── false.rs │ │ │ └── true.rs │ ├── const-generics.rs │ ├── const_generics.rs │ ├── control-brace-style-always-next-line.rs │ ├── control-brace-style-always-same-line.rs │ ├── default-field-values.rs │ ├── doc-attrib.rs │ ├── doc-comment-with-example.rs │ ├── doc-of-generic-item.rs │ ├── doc.rs │ ├── dyn_trait.rs │ ├── else-if-brace-style-always-next-line.rs │ ├── else-if-brace-style-always-same-line.rs │ ├── else-if-brace-style-closing-next-line.rs │ ├── empty-item-single-line-false.rs │ ├── empty-tuple-no-conversion-to-unit-struct.rs │ ├── empty_file.rs │ ├── enum.rs │ ├── ergonomic_clones.rs │ ├── existential_type.rs │ ├── expr-block.rs │ ├── expr-overflow-delimited.rs │ ├── expr.rs │ ├── extern-rust.rs │ ├── extern.rs │ ├── extern_not_explicit.rs │ ├── file-lines-1.rs │ ├── file-lines-2.rs │ ├── file-lines-3.rs │ ├── file-lines-4.rs │ ├── file-lines-5.rs │ ├── file-lines-6.rs │ ├── file-lines-7.rs │ ├── file-lines-item.rs │ ├── fn-args-with-last-line-comment.rs │ ├── fn-custom-2.rs │ ├── fn-custom-3.rs │ ├── fn-custom-4.rs │ ├── fn-custom-6.rs │ ├── fn-custom-7.rs │ ├── fn-custom-8.rs │ ├── fn-custom.rs │ ├── fn-param-attributes.rs │ ├── fn-simple.rs │ ├── fn-single-line │ │ ├── version_one.rs │ │ └── version_two.rs │ ├── fn-ty.rs │ ├── fn.rs │ ├── fn_args_indent-block.rs │ ├── fn_args_layout-vertical.rs │ ├── fn_once.rs │ ├── format_strings │ │ ├── issue-202.rs │ │ ├── issue-2833.rs │ │ ├── issue-3263.rs │ │ ├── issue-687.rs │ │ └── issue564.rs │ ├── guard_patterns.rs │ ├── hard-tabs.rs │ ├── hello.rs │ ├── hex_literal_lower.rs │ ├── hex_literal_preserve.rs │ ├── hex_literal_upper.rs │ ├── if_while_or_patterns.rs │ ├── immovable_coroutines.rs │ ├── impl.rs │ ├── impls.rs │ ├── imports │ │ ├── import-fencepost-length.rs │ │ ├── imports-impl-only-use.rs │ │ ├── imports-reorder-lines-and-items.rs │ │ ├── imports-reorder-lines.rs │ │ ├── imports-reorder.rs │ │ ├── imports.rs │ │ ├── imports_2021_edition.rs │ │ ├── imports_block_indent.rs │ │ ├── imports_granularity_crate.rs │ │ ├── imports_granularity_default-with-dups.rs │ │ ├── imports_granularity_item-with-dups-StdExternalCrate-no-reorder.rs │ │ ├── imports_granularity_item-with-dups.rs │ │ ├── imports_granularity_item.rs │ │ └── imports_granularity_module.rs │ ├── imports_granularity_one.rs │ ├── imports_raw_identifiers │ │ ├── version_One.rs │ │ └── version_Two.rs │ ├── indented-impl.rs │ ├── inner-module-path │ │ ├── b.rs │ │ ├── c │ │ │ └── d.rs │ │ └── lib.rs │ ├── invalid-rust-code-in-doc-comment.rs │ ├── issue-1021.rs │ ├── issue-1049.rs │ ├── issue-1055.rs │ ├── issue-1096.rs │ ├── issue-1111.rs │ ├── issue-1113.rs │ ├── issue-1120.rs │ ├── issue-1124.rs │ ├── issue-1127.rs │ ├── issue-1158.rs │ ├── issue-1177.rs │ ├── issue-1192.rs │ ├── issue-1210 │ │ ├── a.rs │ │ ├── b.rs │ │ ├── c.rs │ │ ├── d.rs │ │ └── e.rs │ ├── issue-1211.rs │ ├── issue-1214.rs │ ├── issue-1216.rs │ ├── issue-1239.rs │ ├── issue-1247.rs │ ├── issue-1255.rs │ ├── issue-1278.rs │ ├── issue-1350.rs │ ├── issue-1366.rs │ ├── issue-1397.rs │ ├── issue-1468.rs │ ├── issue-1598.rs │ ├── issue-1624.rs │ ├── issue-1681.rs │ ├── issue-1693.rs │ ├── issue-1703.rs │ ├── issue-1800.rs │ ├── issue-1802.rs │ ├── issue-1824.rs │ ├── issue-1914.rs │ ├── issue-2025.rs │ ├── issue-2103.rs │ ├── issue-2111.rs │ ├── issue-2123.rs │ ├── issue-2164.rs │ ├── issue-2179 │ │ ├── one.rs │ │ └── two.rs │ ├── issue-2197.rs │ ├── issue-2256.rs │ ├── issue-2324.rs │ ├── issue-2329.rs │ ├── issue-2342.rs │ ├── issue-2346.rs │ ├── issue-2401.rs │ ├── issue-2445.rs │ ├── issue-2446.rs │ ├── issue-2479.rs │ ├── issue-2482 │ │ ├── a.rs │ │ ├── b.rs │ │ └── c.rs │ ├── issue-2496.rs │ ├── issue-2520.rs │ ├── issue-2523.rs │ ├── issue-2526.rs │ ├── issue-2534 │ │ ├── format_macro_matchers_false.rs │ │ └── format_macro_matchers_true.rs │ ├── issue-2551.rs │ ├── issue-2554.rs │ ├── issue-2582.rs │ ├── issue-2641.rs │ ├── issue-2644.rs │ ├── issue-2673-nonmodrs-mods │ │ ├── foo.rs │ │ ├── foo │ │ │ └── bar.rs │ │ └── lib.rs │ ├── issue-2728.rs │ ├── issue-2759.rs │ ├── issue-2761.rs │ ├── issue-2781.rs │ ├── issue-2794.rs │ ├── issue-2810.rs │ ├── issue-2835.rs │ ├── issue-2863.rs │ ├── issue-2869.rs │ ├── issue-2896.rs │ ├── issue-2916.rs │ ├── issue-2917 │ │ ├── minimal.rs │ │ └── packed_simd.rs │ ├── issue-2922.rs │ ├── issue-2927-2.rs │ ├── issue-2927.rs │ ├── issue-2930.rs │ ├── issue-2936.rs │ ├── issue-2941.rs │ ├── issue-2955.rs │ ├── issue-2973.rs │ ├── issue-2976.rs │ ├── issue-2977 │ │ ├── block.rs │ │ ├── impl.rs │ │ ├── item.rs │ │ └── trait.rs │ ├── issue-2985.rs │ ├── issue-2995.rs │ ├── issue-3029.rs │ ├── issue-3032.rs │ ├── issue-3038.rs │ ├── issue-3043.rs │ ├── issue-3049.rs │ ├── issue-3055 │ │ ├── backtick.rs │ │ ├── empty-code-block.rs │ │ └── original.rs │ ├── issue-3059.rs │ ├── issue-3066.rs │ ├── issue-3105.rs │ ├── issue-3118.rs │ ├── issue-3124.rs │ ├── issue-3131.rs │ ├── issue-3132.rs │ ├── issue-3153.rs │ ├── issue-3158.rs │ ├── issue-3182.rs │ ├── issue-3184.rs │ ├── issue-3194.rs │ ├── issue-3198.rs │ ├── issue-3213 │ │ ├── version_one.rs │ │ └── version_two.rs │ ├── issue-3217.rs │ ├── issue-3224.rs │ ├── issue-3227 │ │ ├── one.rs │ │ └── two.rs │ ├── issue-3234.rs │ ├── issue-3241.rs │ ├── issue-3253 │ │ ├── bar.rs │ │ ├── foo.rs │ │ ├── lib.rs │ │ └── paths │ │ │ ├── bar_foo.rs │ │ │ ├── excluded.rs │ │ │ └── foo_bar.rs │ ├── issue-3265.rs │ ├── issue-3270 │ │ ├── one.rs │ │ ├── two.rs │ │ └── wrap.rs │ ├── issue-3272 │ │ ├── v1.rs │ │ └── v2.rs │ ├── issue-3278 │ │ ├── style_edition_2015.rs │ │ ├── style_edition_2024.rs │ │ └── style_edition_2027.rs │ ├── issue-3295 │ │ └── two.rs │ ├── issue-3302.rs │ ├── issue-3304.rs │ ├── issue-3314.rs │ ├── issue-3343.rs │ ├── issue-3423.rs │ ├── issue-3434 │ │ ├── lib.rs │ │ ├── no_entry.rs │ │ └── not_skip_macro.rs │ ├── issue-3442.rs │ ├── issue-3465.rs │ ├── issue-3494 │ │ ├── crlf.rs │ │ └── lf.rs │ ├── issue-3499.rs │ ├── issue-3508.rs │ ├── issue-3515.rs │ ├── issue-3532.rs │ ├── issue-3539.rs │ ├── issue-3554.rs │ ├── issue-3567.rs │ ├── issue-3568.rs │ ├── issue-3585 │ │ ├── extern_crate.rs │ │ ├── reorder_imports_disabled.rs │ │ ├── reorder_imports_enabled.rs │ │ └── use.rs │ ├── issue-3595.rs │ ├── issue-3601.rs │ ├── issue-3614 │ │ ├── version_one.rs │ │ └── version_two.rs │ ├── issue-3636.rs │ ├── issue-3639.rs │ ├── issue-3645.rs │ ├── issue-3651.rs │ ├── issue-3665 │ │ ├── lib.rs │ │ ├── not_skip_attribute.rs │ │ └── sub_mod.rs │ ├── issue-3672.rs │ ├── issue-3675.rs │ ├── issue-3701 │ │ ├── one.rs │ │ └── two.rs │ ├── issue-3709.rs │ ├── issue-3711.rs │ ├── issue-3717.rs │ ├── issue-3718.rs │ ├── issue-3740.rs │ ├── issue-3741.rs │ ├── issue-3750.rs │ ├── issue-3751.rs │ ├── issue-3759.rs │ ├── issue-3779 │ │ ├── ice.rs │ │ └── lib.rs │ ├── issue-3786.rs │ ├── issue-3787.rs │ ├── issue-3805.rs │ ├── issue-3815.rs │ ├── issue-3840 │ │ ├── version-one_hard-tabs.rs │ │ ├── version-one_soft-tabs.rs │ │ ├── version-two_hard-tabs.rs │ │ └── version-two_soft-tabs.rs │ ├── issue-3845.rs │ ├── issue-3882.rs │ ├── issue-3974.rs │ ├── issue-3984.rs │ ├── issue-3987 │ │ ├── format_macro_bodies_false.rs │ │ └── format_macro_bodies_true.rs │ ├── issue-4018.rs │ ├── issue-4020.rs │ ├── issue-4029.rs │ ├── issue-4036 │ │ ├── one.rs │ │ ├── three.rs │ │ └── two.rs │ ├── issue-4041.rs │ ├── issue-4068.rs │ ├── issue-4079.rs │ ├── issue-4115.rs │ ├── issue-4120.rs │ ├── issue-4152.rs │ ├── issue-4159.rs │ ├── issue-4210-disabled.rs │ ├── issue-4210.rs │ ├── issue-4243.rs │ ├── issue-4244.rs │ ├── issue-4245.rs │ ├── issue-4310.rs │ ├── issue-4312.rs │ ├── issue-4313.rs │ ├── issue-4381 │ │ ├── style_edition_2015.rs │ │ └── style_edition_2024.rs │ ├── issue-4382.rs │ ├── issue-4398.rs │ ├── issue-4427.rs │ ├── issue-447.rs │ ├── issue-4530.rs │ ├── issue-4577.rs │ ├── issue-4603.rs │ ├── issue-4615 │ │ └── minimum_example.rs │ ├── issue-4643.rs │ ├── issue-4646.rs │ ├── issue-4656 │ │ ├── format_me_please.rs │ │ ├── lib.rs │ │ └── lib2.rs │ ├── issue-4689 │ │ ├── one.rs │ │ └── two.rs │ ├── issue-4791 │ │ ├── buggy.rs │ │ ├── issue_4928.rs │ │ ├── no_trailing_comma.rs │ │ └── trailing_comma.rs │ ├── issue-4808.rs │ ├── issue-4816 │ │ └── lib.rs │ ├── issue-4908-2.rs │ ├── issue-4908.rs │ ├── issue-4926 │ │ ├── deeply_nested_struct.rs │ │ ├── deeply_nested_struct_with_long_field_names.rs │ │ ├── deeply_nested_struct_with_many_fields.rs │ │ ├── enum_struct_field.rs │ │ ├── minimum_example.rs │ │ ├── struct_with_long_field_names.rs │ │ └── struct_with_many_fields.rs │ ├── issue-4984 │ │ ├── minimum_example.rs │ │ ├── multi_line_derive.rs │ │ ├── multiple_comments_within.rs │ │ └── should_not_change.rs │ ├── issue-5005 │ │ └── minimum_example.rs │ ├── issue-5009 │ │ ├── 1_minimum_example.rs │ │ ├── 2_many_in_connectors_in_pattern.rs │ │ ├── 3_nested_for_loop_with_connector_in_pattern.rs │ │ ├── 4_nested_for_loop_with_if_elseif_else.rs │ │ ├── 5_nested_for_loop_with_connector_in_if_elseif_else.rs │ │ └── 6_deeply_nested_for_loop_with_connector_in_pattern.rs │ ├── issue-5011.rs │ ├── issue-5012 │ │ ├── trailing_comma_always.rs │ │ └── trailing_comma_never.rs │ ├── issue-5023.rs │ ├── issue-5030.rs │ ├── issue-5033 │ │ ├── minimum_example.rs │ │ └── nested_modules.rs │ ├── issue-5042 │ │ ├── multi-line_comment_with_trailing_comma.rs │ │ ├── multi-line_comment_without_trailing_comma.rs │ │ ├── single-line_comment_with_trailing_comma.rs │ │ └── single-line_comment_without_trailing_comma.rs │ ├── issue-5066 │ │ ├── multi_line_struct_trailing_comma_always_struct_lit_width_0.rs │ │ ├── multi_line_struct_trailing_comma_never_struct_lit_width_0.rs │ │ ├── multi_line_struct_with_trailing_comma_always.rs │ │ ├── multi_line_struct_with_trailing_comma_never.rs │ │ ├── with_trailing_comma_always.rs │ │ └── with_trailing_comma_never.rs │ ├── issue-5088 │ │ ├── deeply_nested_long_comment_wrap_comments_false.rs │ │ ├── deeply_nested_long_comment_wrap_comments_true.rs │ │ ├── multi_line_itemized_block_wrap_comments_false.rs │ │ ├── multi_line_itemized_block_wrap_comments_true.rs │ │ ├── multi_line_text_with_itemized_block_wrap_comments_false.rs │ │ ├── multi_line_text_with_itemized_block_wrap_comments_true.rs │ │ ├── single_line_itemized_block_wrap_comments_false.rs │ │ ├── single_line_itemized_block_wrap_comments_true.rs │ │ ├── start_with_empty_comment_very_long_itemized_block_wrap_comments_false.rs │ │ ├── start_with_empty_comment_very_long_itemized_block_wrap_comments_true.rs │ │ ├── start_with_empty_comment_wrap_comments_false.rs │ │ ├── start_with_empty_comment_wrap_comments_true.rs │ │ ├── very_long_comment_wrap_comments_false.rs │ │ └── very_long_comment_wrap_comments_true.rs │ ├── issue-5095.rs │ ├── issue-510.rs │ ├── issue-5125 │ │ ├── attributes_in_formal_fuction_parameter.rs │ │ ├── long_parameter_in_different_positions.rs │ │ ├── minimum_example.rs │ │ └── with_leading_and_inline_comments.rs │ ├── issue-5151 │ │ └── minimum_example.rs │ ├── issue-5157 │ │ ├── indented_itemized_markdown_blockquote.rs │ │ ├── nested_itemized_markdown_blockquote.rs │ │ └── support_itemized_markdown_blockquote.rs │ ├── issue-5234.rs │ ├── issue-5238 │ │ ├── markdown_header_wrap_comments_false.rs │ │ └── markdown_header_wrap_comments_true.rs │ ├── issue-5244 │ │ ├── unwrapped.rs │ │ └── wrapped.rs │ ├── issue-5260.rs │ ├── issue-5270 │ │ ├── merge_derives_false.rs │ │ └── merge_derives_true.rs │ ├── issue-5358.rs │ ├── issue-539.rs │ ├── issue-5488.rs │ ├── issue-5568.rs │ ├── issue-5586.rs │ ├── issue-5655 │ │ ├── one.rs │ │ └── two.rs │ ├── issue-5791.rs │ ├── issue-5797 │ │ └── retain_trailing_semicolon.rs │ ├── issue-5801 │ │ ├── attribute_does_not_wrap_within_max_width.rs │ │ ├── attribute_unexpectedly_wraps_before_max_width.rs │ │ ├── comment_does_not_wrap_within_max_width.rs │ │ └── comment_unexpectedly_wraps_before_max_width.rs │ ├── issue-5835.rs │ ├── issue-5852 │ │ ├── default.rs │ │ ├── horizontal.rs │ │ ├── horizontal_vertical.rs │ │ ├── issue_example.rs │ │ ├── split.rs │ │ └── vertical.rs │ ├── issue-5871.rs │ ├── issue-5885.rs │ ├── issue-5935.rs │ ├── issue-5987 │ │ ├── one.rs │ │ └── two.rs │ ├── issue-6059 │ │ ├── additional.rs │ │ └── repro.rs │ ├── issue-6105.rs │ ├── issue-6109.rs │ ├── issue-6147 │ │ ├── case_rustfmt_v1.rs │ │ └── case_rustfmt_v2.rs │ ├── issue-6202 │ │ └── long_pat.rs │ ├── issue-6333-2024.rs │ ├── issue-6333.rs │ ├── issue-64.rs │ ├── issue-6411.rs │ ├── issue-683.rs │ ├── issue-691.rs │ ├── issue-770.rs │ ├── issue-811.rs │ ├── issue-831.rs │ ├── issue-850.rs │ ├── issue-855.rs │ ├── issue-913.rs │ ├── issue-945.rs │ ├── issue-977.rs │ ├── issue_1306.rs │ ├── issue_3033.rs │ ├── issue_3245.rs │ ├── issue_3561.rs │ ├── issue_3839.rs │ ├── issue_3844.rs │ ├── issue_3853.rs │ ├── issue_3854.rs │ ├── issue_3868.rs │ ├── issue_3934.rs │ ├── issue_3937.rs │ ├── issue_4031.rs │ ├── issue_4032.rs │ ├── issue_4049.rs │ ├── issue_4057.rs │ ├── issue_4086.rs │ ├── issue_4110.rs │ ├── issue_4257.rs │ ├── issue_4322.rs │ ├── issue_4350.rs │ ├── issue_4374.rs │ ├── issue_4467.rs │ ├── issue_4475.rs │ ├── issue_4522.rs │ ├── issue_4528.rs │ ├── issue_4545.rs │ ├── issue_4573.rs │ ├── issue_4579.rs │ ├── issue_4584.rs │ ├── issue_4636.rs │ ├── issue_4675.rs │ ├── issue_4823.rs │ ├── issue_4850.rs │ ├── issue_4854.rs │ ├── issue_4868.rs │ ├── issue_4911.rs │ ├── issue_4936.rs │ ├── issue_4943.rs │ ├── issue_4954.rs │ ├── issue_4963.rs │ ├── issue_5027.rs │ ├── issue_5086.rs │ ├── issue_5273.rs │ ├── issue_5399.rs │ ├── issue_5533.rs │ ├── issue_5542.rs │ ├── issue_5668.rs │ ├── issue_5676.rs │ ├── issue_5686.rs │ ├── issue_5691.rs │ ├── issue_5721.rs │ ├── issue_5728.rs │ ├── issue_5729.rs │ ├── issue_5730.rs │ ├── issue_5735.rs │ ├── issue_5882.rs │ ├── issue_5907.rs │ ├── issue_5912.rs │ ├── issue_6069.rs │ ├── issue_6082.rs │ ├── issue_6158.rs │ ├── issue_6159.rs │ ├── item-brace-style-always-next-line.rs │ ├── item-brace-style-prefer-same-line.rs │ ├── item-brace-style-same-line-where.rs │ ├── itemized-blocks │ │ ├── no_wrap.rs │ │ ├── rewrite_fail.rs │ │ ├── urls.rs │ │ └── wrap.rs │ ├── label_break.rs │ ├── large-block.rs │ ├── large_vec.rs │ ├── lazy_static.rs │ ├── let_chains.rs │ ├── let_else.rs │ ├── let_else_v2.rs │ ├── long-fn-1 │ │ ├── style_edition_2015.rs │ │ ├── style_edition_2024.rs │ │ └── style_edition_2027.rs │ ├── long-match-arms-brace-newline.rs │ ├── long-use-statement-issue-3154.rs │ ├── long_field_access.rs │ ├── loop.rs │ ├── macro_not_expr.rs │ ├── macro_rules.rs │ ├── macro_rules_semi.rs │ ├── macros.rs │ ├── macros │ │ └── rewrite-const-item.rs │ ├── markdown-comment-with-options.rs │ ├── markdown-comment.rs │ ├── match-block-trailing-comma.rs │ ├── match-flattening.rs │ ├── match-nowrap-trailing-comma.rs │ ├── match-nowrap.rs │ ├── match.rs │ ├── match_overflow_expr.rs │ ├── max-line-length-in-chars.rs │ ├── merge_imports_true_compat.rs │ ├── mod-1.rs │ ├── mod-2.rs │ ├── mod_skip_child.rs │ ├── mulit-file.rs │ ├── multiline_string_in_macro_def.rs │ ├── multiple.rs │ ├── mut_ref.rs │ ├── negative-bounds.rs │ ├── negative-impl.rs │ ├── nested-if-else.rs │ ├── nested-visual-block.rs │ ├── nested_skipped │ │ └── mod.rs │ ├── nestedmod │ │ ├── mod.rs │ │ ├── mod2a.rs │ │ ├── mod2b.rs │ │ ├── mod2c.rs │ │ ├── mymod1 │ │ │ └── mod3a.rs │ │ └── submod2 │ │ │ ├── a.rs │ │ │ └── mod.rs │ ├── no_arg_with_comment.rs │ ├── no_new_line_beginning.rs │ ├── non-lifetime-binders.rs │ ├── non_ascii_numerics_import_asciibetically.rs │ ├── non_ascii_numerics_import_versionsort.rs │ ├── normalize_doc_attributes_should_not_imply_format_doc_comments.rs │ ├── normalize_multiline_doc_attribute.rs │ ├── obsolete_in_place.rs │ ├── one_line_if_v1.rs │ ├── one_line_if_v2.rs │ ├── other.rs │ ├── paren.rs │ ├── path_clarity │ │ ├── foo.rs │ │ └── foo │ │ │ └── bar.rs │ ├── paths.rs │ ├── pattern-condense-wildcards.rs │ ├── pattern.rs │ ├── pin_sugar.rs │ ├── postfix-match │ │ └── pf-match.rs │ ├── postfix-yield.rs │ ├── precise-capturing.rs │ ├── preserves_carriage_return_for_unix.rs │ ├── preserves_carriage_return_for_windows.rs │ ├── pub-restricted.rs │ ├── raw-lifetimes.rs │ ├── raw_identifiers.rs │ ├── remove_blank_lines.rs │ ├── reorder-impl-items.rs │ ├── reorder_modules │ │ ├── A2 │ │ │ └── mod.rs │ │ ├── ABCD │ │ │ └── mod.rs │ │ ├── ZYXW │ │ │ └── mod.rs │ │ ├── ZYXW_ │ │ │ └── mod.rs │ │ ├── ZY_XW │ │ │ └── mod.rs │ │ ├── Z_YXW │ │ │ └── mod.rs │ │ ├── _ZYXW │ │ │ └── mod.rs │ │ ├── _abcd │ │ │ └── mod.rs │ │ ├── a1 │ │ │ └── mod.rs │ │ ├── abcd │ │ │ └── mod.rs │ │ ├── disabled_style_edition_2024.rs │ │ ├── enabled_style_edition_2015.rs │ │ ├── enabled_style_edition_2024.rs │ │ ├── u128 │ │ │ └── mod.rs │ │ ├── u16 │ │ │ └── mod.rs │ │ ├── u256 │ │ │ └── mod.rs │ │ ├── u32 │ │ │ └── mod.rs │ │ ├── u64 │ │ │ └── mod.rs │ │ ├── u8 │ │ │ └── mod.rs │ │ ├── u_zzz │ │ │ └── mod.rs │ │ ├── ua │ │ │ └── mod.rs │ │ ├── usize │ │ │ └── mod.rs │ │ ├── uz │ │ │ └── mod.rs │ │ ├── v0 │ │ │ └── mod.rs │ │ ├── v00 │ │ │ └── mod.rs │ │ ├── v000 │ │ │ └── mod.rs │ │ ├── v001 │ │ │ └── mod.rs │ │ ├── v009 │ │ │ └── mod.rs │ │ ├── v00t │ │ │ └── mod.rs │ │ ├── v01 │ │ │ └── mod.rs │ │ ├── v010 │ │ │ └── mod.rs │ │ ├── v09 │ │ │ └── mod.rs │ │ ├── v0s │ │ │ └── mod.rs │ │ ├── v0u │ │ │ └── mod.rs │ │ ├── v1 │ │ │ └── mod.rs │ │ ├── v10 │ │ │ └── mod.rs │ │ ├── v9 │ │ │ └── mod.rs │ │ ├── w005s09t │ │ │ └── mod.rs │ │ ├── w5s009t │ │ │ └── mod.rs │ │ ├── x64 │ │ │ └── mod.rs │ │ ├── x86 │ │ │ └── mod.rs │ │ ├── x86_128 │ │ │ └── mod.rs │ │ ├── x86_32 │ │ │ └── mod.rs │ │ ├── x86_64 │ │ │ └── mod.rs │ │ ├── x87 │ │ │ └── mod.rs │ │ └── zyxw │ │ │ └── mod.rs │ ├── return-type-notation.rs │ ├── should_not_format_string_when_format_strings_is_not_set.rs │ ├── single-line-if-else.rs │ ├── single-line-macro │ │ ├── v1.rs │ │ └── v2.rs │ ├── skip.rs │ ├── skip │ │ ├── foo.rs │ │ ├── main.rs │ │ └── preserve_trailing_comment.rs │ ├── skip_macro_invocations │ │ ├── all.rs │ │ ├── all_and_name.rs │ │ ├── config_file.rs │ │ ├── empty.rs │ │ ├── name.rs │ │ ├── name_unknown.rs │ │ ├── names.rs │ │ ├── path_qualified_invocation_mismatch.rs │ │ ├── path_qualified_match.rs │ │ ├── path_qualified_name_mismatch.rs │ │ └── use_alias_examples.rs │ ├── skip_mod.rs │ ├── soft-wrapping.rs │ ├── space-not-before-newline.rs │ ├── spaces-around-ranges.rs │ ├── statements.rs │ ├── static.rs │ ├── string-lit-2.rs │ ├── string-lit-custom.rs │ ├── string-lit.rs │ ├── string_punctuation.rs │ ├── struct-field-attributes.rs │ ├── struct_field_doc_comment.rs │ ├── struct_lits.rs │ ├── struct_lits_multiline.rs │ ├── struct_lits_visual.rs │ ├── struct_lits_visual_multiline.rs │ ├── struct_tuple_visual.rs │ ├── structs.rs │ ├── style_edition │ │ ├── default.rs │ │ ├── follows_edition.rs │ │ └── overrides_edition_when_set.rs │ ├── trailing-comma-never.rs │ ├── trailing_commas.rs │ ├── trailing_comments │ │ ├── hard_tabs.rs │ │ └── soft_tabs.rs │ ├── trait.rs │ ├── try-conversion.rs │ ├── try_block.rs │ ├── tuple.rs │ ├── tuple_v2.rs │ ├── type-alias-where-clauses-with-comments.rs │ ├── type-alias-where-clauses.rs │ ├── type.rs │ ├── type_alias.rs │ ├── unicode.rs │ ├── unindent_if_else_cond_comment.rs │ ├── unions.rs │ ├── unsafe-binders.rs │ ├── unsafe-field.rs │ ├── unsafe-mod.rs │ ├── unsafe_attributes.rs │ ├── unsafe_extern_blocks.rs │ ├── visibility.rs │ ├── visual-fn-type.rs │ ├── where-clause-rfc.rs │ ├── where-clause.rs │ ├── width-heuristics.rs │ └── wrap_comments_should_not_imply_format_doc_comments.rs └── writemode │ ├── source │ ├── fn-single-line.rs │ ├── json.rs │ ├── modified.rs │ └── stdin.rs │ └── target │ ├── checkstyle.xml │ ├── modified.txt │ ├── output.json │ ├── stdin.json │ └── stdin.xml └── triagebot.toml /check_diff/.gitignore: -------------------------------------------------------------------------------- 1 | /target 2 | -------------------------------------------------------------------------------- /config_proc_macro/.gitignore: -------------------------------------------------------------------------------- 1 | target/ -------------------------------------------------------------------------------- /config_proc_macro/src/item_struct.rs: -------------------------------------------------------------------------------- 1 | use proc_macro2::TokenStream; 2 | 3 | pub fn define_config_type_on_struct(_st: &syn::ItemStruct) -> syn::Result { 4 | unimplemented!() 5 | } 6 | -------------------------------------------------------------------------------- /rust-toolchain: -------------------------------------------------------------------------------- 1 | [toolchain] 2 | channel = "nightly-2025-04-02" 3 | components = ["llvm-tools", "rustc-dev"] 4 | -------------------------------------------------------------------------------- /rustfmt.toml: -------------------------------------------------------------------------------- 1 | error_on_line_overflow = true 2 | error_on_unformatted = true 3 | style_edition = "2024" 4 | overflow_delimited_expr = false 5 | -------------------------------------------------------------------------------- /src/parse/mod.rs: -------------------------------------------------------------------------------- 1 | pub(crate) mod macros; 2 | pub(crate) mod parser; 3 | pub(crate) mod session; 4 | -------------------------------------------------------------------------------- /src/syntux.rs: -------------------------------------------------------------------------------- 1 | //! This module defines a thin abstract layer on top of the rustc's parser and syntax libraries. 2 | 3 | pub(crate) mod parser; 4 | pub(crate) mod session; 5 | -------------------------------------------------------------------------------- /tests/cargo-fmt/source/divergent-crate-dir-names/dependency-dir-name/src/lib.rs: -------------------------------------------------------------------------------- 1 | #[cfg(test)] 2 | mod tests { 3 | #[test] 4 | fn it_works() { 5 | assert_eq!(2 + 2, 4); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/cargo-fmt/source/divergent-crate-dir-names/dependency-dir-name/subdep-dir-name/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "subdep-crate-name" 3 | version = "0.1.0" 4 | authors = ["calebcartwright"] 5 | edition = "2018" 6 | 7 | [dependencies] 8 | -------------------------------------------------------------------------------- /tests/cargo-fmt/source/divergent-crate-dir-names/dependency-dir-name/subdep-dir-name/src/lib.rs: -------------------------------------------------------------------------------- 1 | #[cfg(test)] 2 | mod tests { 3 | #[test] 4 | fn sub_test_that_works() { 5 | assert_eq!(3 + 3, 6); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/cargo-fmt/source/divergent-crate-dir-names/src/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | println!("Hello, world!"); 3 | } 4 | -------------------------------------------------------------------------------- /tests/cargo-fmt/source/issue_3164/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "issue_3164" 3 | version = "0.1.0" 4 | edition = "2021" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | -------------------------------------------------------------------------------- /tests/cargo-fmt/source/workspaces/path-dep-above/e/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "e" 3 | version = "0.1.0" 4 | edition = "2018" 5 | [dependencies] 6 | c = { path = "../ws/c" } 7 | 8 | [workspace] 9 | -------------------------------------------------------------------------------- /tests/cargo-fmt/source/workspaces/path-dep-above/e/src/main.rs: -------------------------------------------------------------------------------- 1 | struct E{ } 2 | -------------------------------------------------------------------------------- /tests/cargo-fmt/source/workspaces/path-dep-above/ws/Cargo.toml: -------------------------------------------------------------------------------- 1 | [workspace] 2 | members = [ 3 | "a", 4 | "b" 5 | ] -------------------------------------------------------------------------------- /tests/cargo-fmt/source/workspaces/path-dep-above/ws/a/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "a" 3 | version = "0.1.0" 4 | edition = "2018" 5 | [dependencies] 6 | d = { path = "./d" } 7 | -------------------------------------------------------------------------------- /tests/cargo-fmt/source/workspaces/path-dep-above/ws/a/d/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "d" 3 | version = "0.1.0" 4 | edition = "2018" 5 | [dependencies] 6 | e = { path = "../../../e" } 7 | f = { path = "f" } 8 | -------------------------------------------------------------------------------- /tests/cargo-fmt/source/workspaces/path-dep-above/ws/a/d/f/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "f" 3 | version = "0.1.0" 4 | edition = "2018" 5 | -------------------------------------------------------------------------------- /tests/cargo-fmt/source/workspaces/path-dep-above/ws/a/d/f/src/lib.rs: -------------------------------------------------------------------------------- 1 | struct F{ } -------------------------------------------------------------------------------- /tests/cargo-fmt/source/workspaces/path-dep-above/ws/a/d/src/lib.rs: -------------------------------------------------------------------------------- 1 | struct D{ } -------------------------------------------------------------------------------- /tests/cargo-fmt/source/workspaces/path-dep-above/ws/a/src/main.rs: -------------------------------------------------------------------------------- 1 | struct D{ } -------------------------------------------------------------------------------- /tests/cargo-fmt/source/workspaces/path-dep-above/ws/b/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "b" 3 | version = "0.1.0" 4 | edition = "2018" 5 | [dependencies] 6 | c = { path = "../c" } 7 | -------------------------------------------------------------------------------- /tests/cargo-fmt/source/workspaces/path-dep-above/ws/b/src/main.rs: -------------------------------------------------------------------------------- 1 | struct B{ } -------------------------------------------------------------------------------- /tests/cargo-fmt/source/workspaces/path-dep-above/ws/c/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "c" 3 | version = "0.1.0" 4 | edition = "2018" 5 | -------------------------------------------------------------------------------- /tests/cargo-fmt/source/workspaces/path-dep-above/ws/c/src/lib.rs: -------------------------------------------------------------------------------- 1 | struct C{ } -------------------------------------------------------------------------------- /tests/config/disable_all_formatting.toml: -------------------------------------------------------------------------------- 1 | disable_all_formatting = true 2 | -------------------------------------------------------------------------------- /tests/config/issue-1111.toml: -------------------------------------------------------------------------------- 1 | reorder_imports = true 2 | -------------------------------------------------------------------------------- /tests/config/issue-2641.toml: -------------------------------------------------------------------------------- 1 | newline_style = "Windows" 2 | -------------------------------------------------------------------------------- /tests/config/issue-3779.toml: -------------------------------------------------------------------------------- 1 | ignore = [ 2 | "tests/**/issue-3779/ice.rs" 3 | ] 4 | -------------------------------------------------------------------------------- /tests/config/issue-5801-v1.toml: -------------------------------------------------------------------------------- 1 | max_width = 120 2 | version = "One" 3 | attr_fn_like_width = 120 -------------------------------------------------------------------------------- /tests/config/issue-5801-v2.toml: -------------------------------------------------------------------------------- 1 | max_width = 120 2 | version = "Two" 3 | attr_fn_like_width = 120 4 | -------------------------------------------------------------------------------- /tests/config/issue-5816.toml: -------------------------------------------------------------------------------- 1 | skip_macro_invocations=["*", "println"] 2 | -------------------------------------------------------------------------------- /tests/config/issue-6302.toml: -------------------------------------------------------------------------------- 1 | edition = 2019 2 | -------------------------------------------------------------------------------- /tests/config/skip_children.toml: -------------------------------------------------------------------------------- 1 | skip_children = true 2 | -------------------------------------------------------------------------------- /tests/config/style-edition/just-style-edition/rustfmt.toml: -------------------------------------------------------------------------------- 1 | style_edition = "2024" 2 | -------------------------------------------------------------------------------- /tests/config/style-edition/just-version/rustfmt.toml: -------------------------------------------------------------------------------- 1 | version = "Two" 2 | -------------------------------------------------------------------------------- /tests/config/style-edition/overrides/rustfmt.toml: -------------------------------------------------------------------------------- 1 | style_edition = "2024" 2 | overflow_delimited_expr = false 3 | -------------------------------------------------------------------------------- /tests/config/style-edition/style-edition-and-edition/rustfmt.toml: -------------------------------------------------------------------------------- 1 | style_edition = "2021" 2 | edition = "2024" 3 | -------------------------------------------------------------------------------- /tests/config/style-edition/version-edition/rustfmt.toml: -------------------------------------------------------------------------------- 1 | version = "Two" 2 | edition = "2018" 3 | -------------------------------------------------------------------------------- /tests/config/style-edition/version-style-edition-and-edition/rustfmt.toml: -------------------------------------------------------------------------------- 1 | version = "Two" 2 | edition = "2018" 3 | style_edition = "2021" 4 | -------------------------------------------------------------------------------- /tests/config/style-edition/version-style-edition/rustfmt.toml: -------------------------------------------------------------------------------- 1 | version = "Two" 2 | style_edition = "2021" 3 | -------------------------------------------------------------------------------- /tests/coverage/source/comments.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-emit_mode: coverage 2 | /// Here's a doc comment! 3 | fn main() { 4 | // foo is bar 5 | let foo = "bar"; 6 | // loooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong comment!!!!! 7 | } 8 | -------------------------------------------------------------------------------- /tests/coverage/target/comments.rs: -------------------------------------------------------------------------------- 1 | XX XXXXXXXXXXXXXXXXXX XXXXXXXX 2 | /// Here's a doc comment! 3 | fn main() { 4 | XX XXX XX XXX 5 | let foo = "bar"; 6 | XX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXX 7 | } 8 | -------------------------------------------------------------------------------- /tests/mod-resolver/issue-4874/bar/baz.rs: -------------------------------------------------------------------------------- 1 | fn 2 | fail_fmt_check 3 | ( 4 | 5 | ) {} -------------------------------------------------------------------------------- /tests/mod-resolver/issue-4874/foo.rs: -------------------------------------------------------------------------------- 1 | mod qux; -------------------------------------------------------------------------------- /tests/mod-resolver/issue-4874/foo/qux.rs: -------------------------------------------------------------------------------- 1 | fn 2 | badly_formatted 3 | ( 4 | 5 | ) {} -------------------------------------------------------------------------------- /tests/mod-resolver/issue-4874/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | println!("Hello, world!"); 3 | } 4 | 5 | mod foo; 6 | mod bar { 7 | mod baz; 8 | } -------------------------------------------------------------------------------- /tests/mod-resolver/issue-5063/foo.rs: -------------------------------------------------------------------------------- 1 | mod bar { 2 | mod baz;} -------------------------------------------------------------------------------- /tests/mod-resolver/issue-5063/foo/bar/baz.rs: -------------------------------------------------------------------------------- 1 | fn baz() { } -------------------------------------------------------------------------------- /tests/mod-resolver/issue-5063/main.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | println!("Hello, world!"); 3 | } 4 | 5 | mod foo; -------------------------------------------------------------------------------- /tests/mod-resolver/issue-5167/src/a.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rust-lang/rustfmt/1443bbac932296a1a5b336a56c31acbf2b238fcd/tests/mod-resolver/issue-5167/src/a.rs -------------------------------------------------------------------------------- /tests/mod-resolver/issue-5167/src/a/mod.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rust-lang/rustfmt/1443bbac932296a1a5b336a56c31acbf2b238fcd/tests/mod-resolver/issue-5167/src/a/mod.rs -------------------------------------------------------------------------------- /tests/mod-resolver/issue-5167/src/lib.rs: -------------------------------------------------------------------------------- 1 | mod a; 2 | -------------------------------------------------------------------------------- /tests/mod-resolver/issue-5198/a.rs: -------------------------------------------------------------------------------- 1 | fn main( ) { println!("Hello World!") } 2 | -------------------------------------------------------------------------------- /tests/mod-resolver/issue-5198/lib.rs: -------------------------------------------------------------------------------- 1 | mod a; 2 | mod b; 3 | mod c; 4 | -------------------------------------------------------------------------------- /tests/mod-resolver/issue-5198/lib/b.rs: -------------------------------------------------------------------------------- 1 | fn main( ) { println!("Hello World!") } 2 | -------------------------------------------------------------------------------- /tests/mod-resolver/issue-5198/lib/c/d.rs: -------------------------------------------------------------------------------- 1 | mod e; 2 | mod f; 3 | mod g; 4 | -------------------------------------------------------------------------------- /tests/mod-resolver/issue-5198/lib/c/d/f.rs: -------------------------------------------------------------------------------- 1 | fn main( ) { println!("Hello World!") } 2 | -------------------------------------------------------------------------------- /tests/mod-resolver/issue-5198/lib/c/d/g/mod.rs: -------------------------------------------------------------------------------- 1 | fn main( ) { println!("Hello World!") } 2 | -------------------------------------------------------------------------------- /tests/mod-resolver/issue-5198/lib/c/e.rs: -------------------------------------------------------------------------------- 1 | fn main( ) { println!("Hello World!") } 2 | -------------------------------------------------------------------------------- /tests/mod-resolver/issue-5198/lib/c/mod.rs: -------------------------------------------------------------------------------- 1 | mod d; 2 | 3 | fn main( ) { println!("Hello World!") } 4 | -------------------------------------------------------------------------------- /tests/mod-resolver/module-not-found/bad_path_attribute/lib.rs: -------------------------------------------------------------------------------- 1 | // module resolution fails because the path does not exist. 2 | #[path = "path/to/does_not_exist.rs"] 3 | mod a; 4 | -------------------------------------------------------------------------------- /tests/mod-resolver/module-not-found/relative_module/a.rs: -------------------------------------------------------------------------------- 1 | // module resolution fails because `./a/b.rs` does not exist 2 | mod b; 3 | -------------------------------------------------------------------------------- /tests/mod-resolver/module-not-found/relative_module/lib.rs: -------------------------------------------------------------------------------- 1 | mod a; 2 | -------------------------------------------------------------------------------- /tests/mod-resolver/module-not-found/sibling_module/lib.rs: -------------------------------------------------------------------------------- 1 | // module resolution fails because `./a.rs` does not exist 2 | mod a; 3 | -------------------------------------------------------------------------------- /tests/mod-resolver/skip-files-issue-5065/foo.rs: -------------------------------------------------------------------------------- 1 | #![rustfmt::skip] 2 | 3 | mod bar { 4 | 5 | mod baz;} -------------------------------------------------------------------------------- /tests/mod-resolver/skip-files-issue-5065/foo/bar/baz.rs: -------------------------------------------------------------------------------- 1 | fn baz() { } -------------------------------------------------------------------------------- /tests/mod-resolver/skip-files-issue-5065/main.rs: -------------------------------------------------------------------------------- 1 | #![rustfmt::skip] 2 | 3 | mod foo; 4 | mod one; 5 | 6 | fn main() {println!("Hello, world!"); 7 | } 8 | 9 | // trailing comment 10 | -------------------------------------------------------------------------------- /tests/mod-resolver/skip-files-issue-5065/one.rs: -------------------------------------------------------------------------------- 1 | struct One { value: String } -------------------------------------------------------------------------------- /tests/mod-resolver/test-submodule-issue-5119/Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "rustfmt-test-submodule-issue" 3 | version = "0.1.0" 4 | edition = "2018" 5 | 6 | # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html 7 | 8 | [dependencies] 9 | -------------------------------------------------------------------------------- /tests/mod-resolver/test-submodule-issue-5119/src/lib.rs: -------------------------------------------------------------------------------- 1 | pub fn foo() -> i32 { 2 | 3 3 | } 4 | 5 | pub fn bar() -> i32 { 6 | 4 7 | } 8 | -------------------------------------------------------------------------------- /tests/mod-resolver/test-submodule-issue-5119/tests/test1.rs: -------------------------------------------------------------------------------- 1 | mod test1 { 2 | #[cfg(unix)] 3 | mod sub1; 4 | #[cfg(not(unix))] 5 | mod sub2; 6 | 7 | mod sub3; 8 | } 9 | -------------------------------------------------------------------------------- /tests/mod-resolver/test-submodule-issue-5119/tests/test1/sub1.rs: -------------------------------------------------------------------------------- 1 | use rustfmt_test_submodule_issue::foo; 2 | 3 | #[test] 4 | fn test_foo() { 5 | assert_eq!(3, foo()); 6 | } 7 | -------------------------------------------------------------------------------- /tests/mod-resolver/test-submodule-issue-5119/tests/test1/sub2.rs: -------------------------------------------------------------------------------- 1 | use rustfmt_test_submodule_issue::bar; 2 | 3 | #[test] 4 | fn test_bar() { 5 | assert_eq!(4, bar()); 6 | } 7 | -------------------------------------------------------------------------------- /tests/mod-resolver/test-submodule-issue-5119/tests/test1/sub3/mod.rs: -------------------------------------------------------------------------------- 1 | mod sub4; 2 | -------------------------------------------------------------------------------- /tests/mod-resolver/test-submodule-issue-5119/tests/test1/sub3/sub4.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rust-lang/rustfmt/1443bbac932296a1a5b336a56c31acbf2b238fcd/tests/mod-resolver/test-submodule-issue-5119/tests/test1/sub3/sub4.rs -------------------------------------------------------------------------------- /tests/parser/issue-4126/invalid.rs: -------------------------------------------------------------------------------- 1 | fn foo() { 2 | if bar && if !baz { 3 | next_is_none = Some(true); 4 | } 5 | println!("foo"); 6 | } 7 | -------------------------------------------------------------------------------- /tests/parser/issue-4126/lib.rs: -------------------------------------------------------------------------------- 1 | mod invalid; 2 | -------------------------------------------------------------------------------- /tests/parser/issue_4418.rs: -------------------------------------------------------------------------------- 1 | } -------------------------------------------------------------------------------- /tests/parser/stashed-diag.rs: -------------------------------------------------------------------------------- 1 | #![u={static N;}] 2 | 3 | fn main() {} 4 | -------------------------------------------------------------------------------- /tests/parser/stashed-diag2.rs: -------------------------------------------------------------------------------- 1 | trait Trait<'1> { s> {} 2 | 3 | fn main() {} 4 | -------------------------------------------------------------------------------- /tests/parser/unclosed-delims/issue_4466.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | if true { 3 | println!("answer: {}", a_func(); 4 | } else { 5 | println!("don't think so."); 6 | } 7 | } 8 | 9 | fn a_func() -> i32 { 10 | 42 11 | } -------------------------------------------------------------------------------- /tests/source/arrow_in_comments/arrow_in_single_comment.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2024 2 | fn main() { 3 | match a { 4 | _ => 5 | // comment with => 6 | { 7 | println!("A") 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tests/source/associated-types-bounds-wrapping.rs: -------------------------------------------------------------------------------- 1 | // Test proper wrapping of long associated type bounds 2 | 3 | pub trait HttpService { 4 | type WsService: 'static + Service; 5 | } 6 | -------------------------------------------------------------------------------- /tests/source/cfg_if/detect/os/other.rs: -------------------------------------------------------------------------------- 1 | //! Other operating systems 2 | 3 | use crate::detect::Feature; 4 | 5 | /// Performs run-time feature detection. 6 | #[inline] 7 | pub fn check_for(_x: Feature) -> bool { 8 | false 9 | } 10 | -------------------------------------------------------------------------------- /tests/source/cfg_if/mod.rs: -------------------------------------------------------------------------------- 1 | //! `std_detect` 2 | 3 | #[doc(hidden)] // unstable implementation detail 4 | #[unstable(feature = "stdsimd", issue = "27731")] 5 | pub mod detect; 6 | -------------------------------------------------------------------------------- /tests/source/cfg_match/format_me_please_1.rs: -------------------------------------------------------------------------------- 1 | 2 | pub fn format_me_please_1( ) { } 3 | -------------------------------------------------------------------------------- /tests/source/cfg_match/format_me_please_2.rs: -------------------------------------------------------------------------------- 1 | 2 | pub fn format_me_please_2( ) { } 3 | -------------------------------------------------------------------------------- /tests/source/cfg_match/format_me_please_3.rs: -------------------------------------------------------------------------------- 1 | 2 | pub fn format_me_please_3( ) { } 3 | -------------------------------------------------------------------------------- /tests/source/cfg_match/format_me_please_4.rs: -------------------------------------------------------------------------------- 1 | 2 | pub fn format_me_please_4( ) { } 3 | -------------------------------------------------------------------------------- /tests/source/cfg_match/lib2.rs: -------------------------------------------------------------------------------- 1 | its_a_macro! { 2 | // Contents 3 | } 4 | -------------------------------------------------------------------------------- /tests/source/cfg_mod/bar.rs: -------------------------------------------------------------------------------- 1 | fn bar( ) -> &str { 2 | "bar" 3 | } 4 | -------------------------------------------------------------------------------- /tests/source/cfg_mod/dir/dir1/dir2/wasm32.rs: -------------------------------------------------------------------------------- 1 | fn 2 | wasm32 3 | () -> &str 4 | { 5 | "wasm32" 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/cfg_mod/dir/dir1/dir3/wasm32.rs: -------------------------------------------------------------------------------- 1 | fn 2 | wasm32 3 | () -> &str 4 | { 5 | "wasm32" 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/cfg_mod/foo.rs: -------------------------------------------------------------------------------- 1 | fn foo( ) 2 | -> &str { 3 | "foo" 4 | } 5 | -------------------------------------------------------------------------------- /tests/source/cfg_mod/other.rs: -------------------------------------------------------------------------------- 1 | fn other() -> &str { "other"} 2 | -------------------------------------------------------------------------------- /tests/source/cfg_mod/wasm32.rs: -------------------------------------------------------------------------------- 1 | fn 2 | wasm32() -> &str { 3 | "wasm32" 4 | } 5 | -------------------------------------------------------------------------------- /tests/source/comment2.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-wrap_comments: true 2 | 3 | /// This is a long line that angers rustfmt. Rustfmt shall deal with it swiftly and justly. 4 | pub mod foo {} 5 | -------------------------------------------------------------------------------- /tests/source/comment3.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-wrap_comments: true 2 | 3 | //! This is a long line that angers rustfmt. Rustfmt shall deal with it swiftly and justly. 4 | 5 | pub mod foo {} 6 | -------------------------------------------------------------------------------- /tests/source/comment_crlf_newline.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-normalize_comments: true 2 | /* Block comments followed by CRLF newlines should not an extra newline at the end */ 3 | 4 | /* Something else */ 5 | -------------------------------------------------------------------------------- /tests/source/configs/blank_lines_lower_bound/1.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-blank_lines_lower_bound: 1 2 | 3 | fn foo() {} 4 | fn bar() {} 5 | // comment 6 | fn foobar() {} 7 | 8 | fn foo1() {} 9 | fn bar1() {} 10 | 11 | // comment 12 | 13 | fn foobar1() {} 14 | -------------------------------------------------------------------------------- /tests/source/configs/comment_width/above.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-comment_width: 40 2 | // rustfmt-wrap_comments: true 3 | // Comment width 4 | 5 | fn main() { 6 | // Lorem ipsum dolor sit amet, consectetur adipiscing elit. 7 | } 8 | -------------------------------------------------------------------------------- /tests/source/configs/comment_width/below.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-comment_width: 80 2 | // rustfmt-wrap_comments: true 3 | // Comment width 4 | 5 | fn main() { 6 | // Lorem ipsum dolor sit amet, consectetur adipiscing elit. 7 | } 8 | -------------------------------------------------------------------------------- /tests/source/configs/comment_width/ignore.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-comment_width: 40 2 | // rustfmt-wrap_comments: false 3 | // Comment width 4 | 5 | fn main() { 6 | // Lorem ipsum dolor sit amet, consectetur adipiscing elit. 7 | } 8 | -------------------------------------------------------------------------------- /tests/source/configs/condense_wildcard_suffixes/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-condense_wildcard_suffixes: false 2 | // Condense wildcard suffixes 3 | 4 | fn main() { 5 | let (lorem, ipsum, _, _) = (1, 2, 3, 4); 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/condense_wildcard_suffixes/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-condense_wildcard_suffixes: true 2 | // Condense wildcard suffixes 3 | 4 | fn main() { 5 | let (lorem, ipsum, _, _) = (1, 2, 3, 4); 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/disable_all_formatting/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-disable_all_formatting: false 2 | // Disable all formatting 3 | 4 | fn main() { 5 | if lorem{println!("ipsum!");}else{println!("dolor!");} 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/disable_all_formatting/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-disable_all_formatting: true 2 | // Disable all formatting 3 | 4 | fn main() { 5 | iflorem{println!("ipsum!");}else{println!("dolor!");} 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/empty_item_single_line/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-empty_item_single_line: false 2 | // Empty impl on single line 3 | 4 | impl Lorem { 5 | 6 | } 7 | 8 | impl Ipsum { 9 | 10 | } 11 | 12 | fn lorem() { 13 | } 14 | 15 | fn lorem() { 16 | } 17 | -------------------------------------------------------------------------------- /tests/source/configs/empty_item_single_line/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-empty_item_single_line: true 2 | // Empty impl on single line 3 | 4 | impl Lorem { 5 | 6 | } 7 | 8 | impl Ipsum { 9 | 10 | } 11 | 12 | fn lorem() { 13 | } 14 | 15 | fn lorem() { 16 | } 17 | -------------------------------------------------------------------------------- /tests/source/configs/error_on_line_overflow/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-error_on_line_overflow: false 2 | // Error on line overflow 3 | 4 | fn main() { 5 | let lorem_ipsum_dolor_sit_amet_consectetur_adipiscing_elit_lorem_ipsum_dolor_sit_amet_consectetur_adipiscing_elit; 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/fn_single_line/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-fn_single_line: false 2 | // Single-expression function on single line 3 | 4 | fn lorem() -> usize { 5 | 42 6 | } 7 | 8 | fn lorem() -> usize { 9 | let ipsum = 42; 10 | ipsum 11 | } 12 | -------------------------------------------------------------------------------- /tests/source/configs/fn_single_line/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-fn_single_line: true 2 | // Single-expression function on single line 3 | 4 | fn lorem() -> usize { 5 | 42 6 | } 7 | 8 | fn lorem() -> usize { 9 | let ipsum = 42; 10 | ipsum 11 | } 12 | -------------------------------------------------------------------------------- /tests/source/configs/force_explicit_abi/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-force_explicit_abi: false 2 | // Force explicit abi 3 | 4 | extern { 5 | pub static lorem: c_int; 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/force_explicit_abi/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-force_explicit_abi: true 2 | // Force explicit abi 3 | 4 | extern { 5 | pub static lorem: c_int; 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/format_generated_files/false.rs: -------------------------------------------------------------------------------- 1 | // @generated 2 | // rustfmt-format_generated_files: false 3 | 4 | fn main() 5 | { 6 | println!("hello, world") 7 | ; 8 | } 9 | -------------------------------------------------------------------------------- /tests/source/configs/format_generated_files/false_with_generated_marker_line_search_limit.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_generated_files: false 2 | // rustfmt-generated_marker_line_search_limit: 15 3 | 4 | fn main() 5 | { 6 | println!("hello, world") 7 | ; 8 | } 9 | 10 | // @generated -------------------------------------------------------------------------------- /tests/source/configs/format_generated_files/false_with_marker_out_scope_size.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_generated_files: false 2 | // rustfmt-generated_marker_line_search_limit: 1 3 | 4 | fn main() 5 | { 6 | println!("hello, world") 7 | ; 8 | } 9 | 10 | // @generated -------------------------------------------------------------------------------- /tests/source/configs/format_generated_files/false_with_zero_search_limit.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_generated_files: false 2 | // rustfmt-generated_marker_line_search_limit: 0 3 | 4 | // @generated 5 | fn main() { 6 | println!("hello, world") 7 | ; 8 | } 9 | // @generated 10 | -------------------------------------------------------------------------------- /tests/source/configs/format_generated_files/true.rs: -------------------------------------------------------------------------------- 1 | // @generated 2 | // rustfmt-format_generated_files: true 3 | 4 | fn main() 5 | { 6 | println!("hello, world") 7 | ; 8 | } 9 | -------------------------------------------------------------------------------- /tests/source/configs/format_generated_files/true_with_marker_in_scope_size.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_generated_files: true 2 | // rustfmt-generated_marker_line_search_limit: 20 3 | 4 | fn main() 5 | { 6 | println!("hello, world") 7 | ; 8 | } 9 | 10 | // @generated 11 | -------------------------------------------------------------------------------- /tests/source/configs/format_generated_files/true_with_marker_not_in_header.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_generated_files: true 2 | 3 | fn main() 4 | { 5 | println!("hello, world") 6 | ; 7 | } 8 | 9 | // @generated -------------------------------------------------------------------------------- /tests/source/configs/format_macro_bodies/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_macro_bodies: false 2 | 3 | macro_rules! foo { 4 | ($a: ident : $b: ty) => { $a(42): $b; }; 5 | ($a: ident $b: ident $c: ident) => { $a=$b+$c; }; 6 | } 7 | 8 | -------------------------------------------------------------------------------- /tests/source/configs/format_macro_bodies/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_macro_bodies: true 2 | 3 | macro_rules! foo { 4 | ($a: ident : $b: ty) => { $a(42): $b; }; 5 | ($a: ident $b: ident $c: ident) => { $a=$b+$c; }; 6 | } 7 | 8 | -------------------------------------------------------------------------------- /tests/source/configs/format_macro_matchers/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_macro_matchers: false 2 | 3 | macro_rules! foo { 4 | ($a: ident : $b: ty) => { $a(42): $b; }; 5 | ($a: ident $b: ident $c: ident) => { $a=$b+$c; }; 6 | } 7 | 8 | -------------------------------------------------------------------------------- /tests/source/configs/format_macro_matchers/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_macro_matchers: true 2 | 3 | macro_rules! foo { 4 | ($a: ident : $b: ty) => { $a(42): $b; }; 5 | ($a: ident $b: ident $c: ident) => { $a=$b+$c; }; 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/format_strings/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_strings: true 2 | // rustfmt-max_width: 50 3 | // Force format strings 4 | 5 | fn main() { 6 | let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit"; 7 | } 8 | -------------------------------------------------------------------------------- /tests/source/configs/group_imports/One-nested.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-group_imports: One 2 | mod test { 3 | use crate::foo::bar; 4 | 5 | use std::path; 6 | use crate::foo::bar2; 7 | } 8 | -------------------------------------------------------------------------------- /tests/source/configs/group_imports/StdExternalCrate-nested.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-group_imports: StdExternalCrate 2 | mod test { 3 | use crate::foo::bar; 4 | use std::path; 5 | use crate::foo::bar2; 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/hard_tabs/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-hard_tabs: false 2 | // Hard tabs 3 | 4 | fn lorem() -> usize { 5 | 42 // spaces before 42 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/hard_tabs/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-hard_tabs: true 2 | // Hard tabs 3 | 4 | fn lorem() -> usize { 5 | 42 // spaces before 42 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/imports_layout/merge_mixed.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-imports_indent: Block 2 | // rustfmt-imports_granularity: Crate 3 | // rustfmt-imports_layout: Mixed 4 | 5 | use std::{fmt, io, str}; 6 | use std::str::FromStr; 7 | -------------------------------------------------------------------------------- /tests/source/configs/indent_style/block_array.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style: Block 2 | // Array layout 3 | 4 | fn main() { 5 | let lorem = vec!["ipsum","dolor","sit","amet","consectetur","adipiscing","elit"]; 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/indent_style/block_chain.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style: Block 2 | // Chain indent 3 | 4 | fn main() { 5 | let lorem = ipsum.dolor().sit().amet().consectetur().adipiscing().elite(); 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/indent_style/block_struct_lit.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style: Block 2 | // Struct literal-style 3 | 4 | fn main() { 5 | let lorem = Lorem { ipsum: dolor, sit: amet }; 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/indent_style/block_where_pred.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style: Block 2 | // Where predicate indent 3 | 4 | fn lorem() -> T where Ipsum: Eq, Dolor: Eq, Sit: Eq, Amet: Eq { 5 | // body 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/indent_style/default.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style: Visual 2 | // Where style 3 | 4 | fn lorem() -> T where Ipsum: Eq, Dolor: Eq, Sit: Eq, Amet: Eq { 5 | // body 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/indent_style/rfc_where.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style: Block 2 | // Where style 3 | 4 | fn lorem() -> T where Ipsum: Eq, Dolor: Eq, Sit: Eq, Amet: Eq { 5 | // body 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/indent_style/visual_array.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style: Visual 2 | // Array layout 3 | 4 | fn main() { 5 | let lorem = vec!["ipsum","dolor","sit","amet","consectetur","adipiscing","elit"]; 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/indent_style/visual_call.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style: Visual 2 | // Function call style 3 | 4 | fn main() { 5 | lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit"); 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/indent_style/visual_chain.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style: Visual 2 | // Chain indent 3 | 4 | fn main() { 5 | let lorem = ipsum.dolor().sit().amet().consectetur().adipiscing().elite(); 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/indent_style/visual_struct_lit.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style: Visual 2 | // Struct literal-style 3 | 4 | fn main() { 5 | let lorem = Lorem { ipsum: dolor, sit: amet }; 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/indent_style/visual_where_pred.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style: Visual 2 | // Where predicate indent 3 | 4 | fn lorem() -> T where Ipsum: Eq, Dolor: Eq, Sit: Eq, Amet: Eq { 5 | // body 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/remove_nested_parens/remove_nested_parens.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-remove_nested_parens: true 2 | 3 | fn main() { 4 | ((((((foo())))))); 5 | } 6 | -------------------------------------------------------------------------------- /tests/source/configs/reorder_impl_items/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-reorder_impl_items: false 2 | 3 | struct Dummy; 4 | 5 | impl Iterator for Dummy { 6 | fn next(&mut self) -> Option { 7 | None 8 | } 9 | 10 | type Item = i32; 11 | } 12 | -------------------------------------------------------------------------------- /tests/source/configs/reorder_impl_items/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-reorder_impl_items: true 2 | 3 | struct Dummy; 4 | 5 | impl Iterator for Dummy { 6 | fn next(&mut self) -> Option { 7 | None 8 | } 9 | 10 | type Item = i32; 11 | } 12 | -------------------------------------------------------------------------------- /tests/source/configs/reorder_imports/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-reorder_imports: false 2 | // Reorder imports 3 | 4 | use lorem; 5 | use ipsum; 6 | use dolor; 7 | use sit; 8 | -------------------------------------------------------------------------------- /tests/source/configs/reorder_modules/dolor/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/configs/reorder_modules/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-reorder_modules: false 2 | // Reorder modules 3 | 4 | mod lorem; 5 | mod ipsum; 6 | mod dolor; 7 | mod sit; 8 | -------------------------------------------------------------------------------- /tests/source/configs/reorder_modules/ipsum/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/configs/reorder_modules/lorem/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/configs/reorder_modules/sit/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/configs/reorder_modules/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-reorder_modules: true 2 | // Reorder modules 3 | 4 | mod lorem; 5 | mod ipsum; 6 | mod dolor; 7 | mod sit; 8 | -------------------------------------------------------------------------------- /tests/source/configs/skip_children/foo/mod.rs: -------------------------------------------------------------------------------- 1 | fn skip_formatting_this() { 2 | println ! ( "Skip this" ) ; 3 | } 4 | -------------------------------------------------------------------------------- /tests/source/configs/skip_children/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-skip_children: true 2 | 3 | mod foo ; 4 | mod void; 5 | -------------------------------------------------------------------------------- /tests/source/configs/space_before_colon/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-space_before_colon: true 2 | // Space before colon 3 | 4 | fn lorem(t : T) { 5 | let ipsum: Dolor = sit; 6 | } 7 | 8 | const LOREM : Lorem = Lorem { 9 | ipsum : dolor, 10 | sit : amet, 11 | }; 12 | -------------------------------------------------------------------------------- /tests/source/configs/struct_lit_single_line/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-struct_lit_single_line: false 2 | // Struct literal multiline-style 3 | 4 | fn main() { 5 | let lorem = Lorem { ipsum: dolor, sit: amet }; 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/tab_spaces/2.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-tab_spaces: 2 2 | // rustfmt-max_width: 30 3 | // rustfmt-indent_style: Block 4 | // Tab spaces 5 | 6 | fn lorem() { 7 | let ipsum = dolor(); 8 | let sit = vec![ 9 | "amet", "consectetur", "adipiscing", "elit." 10 | ]; 11 | } 12 | -------------------------------------------------------------------------------- /tests/source/configs/tab_spaces/4.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-tab_spaces: 4 2 | // rustfmt-max_width: 30 3 | // rustfmt-indent_style: Block 4 | // Tab spaces 5 | 6 | fn lorem() { 7 | let ipsum = dolor(); 8 | let sit = vec![ 9 | "amet", "consectetur", "adipiscing", "elit." 10 | ]; 11 | } 12 | -------------------------------------------------------------------------------- /tests/source/configs/trailing_comma/always.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-trailing_comma: Always 2 | // Trailing comma 3 | 4 | fn main() { 5 | let Lorem { ipsum, dolor, sit, } = amet; 6 | let Lorem { ipsum, dolor, sit, amet, consectetur, adipiscing } = elit; 7 | } 8 | -------------------------------------------------------------------------------- /tests/source/configs/trailing_comma/vertical.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-trailing_comma: Vertical 2 | // Trailing comma 3 | 4 | fn main() { 5 | let Lorem { ipsum, dolor, sit, } = amet; 6 | let Lorem { ipsum, dolor, sit, amet, consectetur, adipiscing } = elit; 7 | } 8 | -------------------------------------------------------------------------------- /tests/source/configs/use_try_shorthand/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-use_try_shorthand: false 2 | // Use try! shorthand 3 | 4 | fn main() { 5 | let lorem = try!(ipsum.map(|dolor| dolor.sit())); 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/configs/use_try_shorthand/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-use_try_shorthand: true 2 | // Use try! shorthand 3 | 4 | fn main() { 5 | let lorem = try!(ipsum.map(|dolor| dolor.sit())); 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/doc.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-normalize_comments: true 2 | // Part of multiple.rs 3 | 4 | // sadfsdfa 5 | //sdffsdfasdf 6 | -------------------------------------------------------------------------------- /tests/source/empty_file.rs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rust-lang/rustfmt/1443bbac932296a1a5b336a56c31acbf2b238fcd/tests/source/empty_file.rs -------------------------------------------------------------------------------- /tests/source/hello.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-config: small_tabs.toml 2 | // rustfmt-target: hello.rs 3 | 4 | // Smoke test - hello world. 5 | 6 | fn main() { println!("Hello world!"); } 7 | -------------------------------------------------------------------------------- /tests/source/hello2.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-config: small_tabs.toml 2 | // rustfmt-target: hello.rs 3 | 4 | // Smoke test - hello world. 5 | 6 | fn main( ) { 7 | println!("Hello world!"); 8 | } 9 | -------------------------------------------------------------------------------- /tests/source/hex_literal_lower.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-hex_literal_case: Lower 2 | fn main() { 3 | let h1 = 0xCAFE_5EA7; 4 | let h2 = 0xCAFE_F00Du32; 5 | } 6 | -------------------------------------------------------------------------------- /tests/source/hex_literal_upper.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-hex_literal_case: Upper 2 | fn main() { 3 | let h1 = 0xCaFE_5ea7; 4 | let h2 = 0xCAFE_F00Du32; 5 | } 6 | -------------------------------------------------------------------------------- /tests/source/immovable_coroutines.rs: -------------------------------------------------------------------------------- 1 | #![feature(coroutines)] 2 | 3 | unsafe fn foo() { 4 | let mut ga = #[coroutine] 5 | static || { 6 | yield 1; 7 | }; 8 | } 9 | -------------------------------------------------------------------------------- /tests/source/imports/imports-impl-only-use.rs: -------------------------------------------------------------------------------- 1 | #![feature(underscore_imports)] 2 | 3 | use attr; 4 | use std::iter::Iterator as _; 5 | -------------------------------------------------------------------------------- /tests/source/imports/imports-reorder.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-normalize_comments: true 2 | 3 | use path::{C,/*A*/ A, B /* B */, self /* self */}; 4 | 5 | use {ab, ac, aa, Z, b}; 6 | -------------------------------------------------------------------------------- /tests/source/imports/imports_block_indent.rs: -------------------------------------------------------------------------------- 1 | // #2569 2 | use apns2::request::notification::{Notificatio, NotificationBuilder, Priority, SilentNotificationBuilder}; 3 | -------------------------------------------------------------------------------- /tests/source/imports/imports_granularity_default-with-dups.rs: -------------------------------------------------------------------------------- 1 | use crate::lexer; 2 | use crate::lexer::tokens::TokenData; 3 | use crate::lexer::{tokens::TokenData}; 4 | use crate::lexer::self; 5 | use crate::lexer::{self}; 6 | use crate::lexer::{self, tokens::TokenData}; 7 | -------------------------------------------------------------------------------- /tests/source/imports_raw_identifiers/version_One.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-version:One 2 | 3 | use websocket::client::ClientBuilder; 4 | use websocket::r#async::futures::Stream; 5 | use websocket::result::WebSocketError; 6 | -------------------------------------------------------------------------------- /tests/source/imports_raw_identifiers/version_Two.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-version:Two 2 | 3 | use websocket::client::ClientBuilder; 4 | use websocket::r#async::futures::Stream; 5 | use websocket::result::WebSocketError; 6 | -------------------------------------------------------------------------------- /tests/source/issue-1111.rs: -------------------------------------------------------------------------------- 1 | use bar; 2 | -------------------------------------------------------------------------------- /tests/source/issue-1124.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-reorder_imports: true 2 | 3 | use d; use c; use b; use a; 4 | // The previous line has a space after the `use a;` 5 | 6 | mod a { use d; use c; use b; use a; } 7 | 8 | use z; 9 | 10 | use y; 11 | 12 | 13 | 14 | use x; 15 | use a; 16 | -------------------------------------------------------------------------------- /tests/source/issue-1158.rs: -------------------------------------------------------------------------------- 1 | trait T { 2 | itemmacro!(this, is.now() .formatted(yay)); 3 | } 4 | -------------------------------------------------------------------------------- /tests/source/issue-1177.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-normalize_comments: true 2 | fn main() { 3 | // Line Comment 4 | /* Block Comment */ 5 | 6 | let d = 5; 7 | } 8 | -------------------------------------------------------------------------------- /tests/source/issue-1192.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | assert!(true) ; 3 | } 4 | -------------------------------------------------------------------------------- /tests/source/issue-1210/c.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_strings: true 2 | // rustfmt-max_width: 50 3 | 4 | const foo: String = "trailing_spaces!! 5 | keep them! Amet neque. Praesent rhoncus eros non velit."; 6 | -------------------------------------------------------------------------------- /tests/source/issue-1210/d.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-wrap_comments: true 2 | 3 | // trailing_spaces_in_comment!! 4 | // remove those from above 5 | -------------------------------------------------------------------------------- /tests/source/issue-1216.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-normalize_comments: true 2 | enum E { 3 | A, //* I am not a block comment (caused panic) 4 | B, 5 | } 6 | -------------------------------------------------------------------------------- /tests/source/issue-1278.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style = "block" 2 | 3 | #![feature(pub_restricted)] 4 | 5 | mod inner_mode { 6 | pub(super) fn func_name(abc: i32) -> i32 { 7 | abc 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tests/source/issue-1693.rs: -------------------------------------------------------------------------------- 1 | fn issue1693() { 2 | let pixel_data = vec![(f16::from_f32(0.82), f16::from_f32(1.78), f16::from_f32(0.21)); 256 * 256]; 3 | } 4 | -------------------------------------------------------------------------------- /tests/source/issue-1800.rs: -------------------------------------------------------------------------------- 1 | #![doc(html_root_url = "http://example.com")] 2 | #[cfg(feature = "foo")] 3 | fn a() {} 4 | -------------------------------------------------------------------------------- /tests/source/issue-1914.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-max_width: 80 2 | 3 | extern "C" { 4 | #[link_name = "_ZN7MyClass26example_check_no_collisionE"] 5 | pub static mut MyClass_example_check_no_collision : * const :: std :: os :: raw :: c_int ; 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/issue-2025.rs: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | // See if rustfmt removes empty lines on top of the file. 6 | pub fn foo() { 7 | println!("hello, world"); 8 | } 9 | -------------------------------------------------------------------------------- /tests/source/issue-2256.rs: -------------------------------------------------------------------------------- 1 | // こんにちは 2 | use std::{}; 3 | use std::borrow::Cow; 4 | 5 | /* comment 1 */ use std::{}; 6 | /* comment 2 */ use std::{}; 7 | 8 | 9 | 10 | 11 | 12 | /* comment 3 */ use std::{}; 13 | -------------------------------------------------------------------------------- /tests/source/issue-2342.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-max_width: 80 2 | 3 | struct Foo { 4 | #[cfg(feature = "serde")] bytes: [[u8; 17]; 5], // Same size as signature::ED25519_PKCS8_V2_LEN 5 | } 6 | -------------------------------------------------------------------------------- /tests/source/issue-2446.rs: -------------------------------------------------------------------------------- 1 | enum Issue2446 { 2 | V { 3 | f: u8, // x 4 | }, 5 | } 6 | 7 | enum Issue2446TrailingCommentsOnly { 8 | V { 9 | f: u8, /* */ 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tests/source/issue-2482/a.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-reorder_modules: true 2 | 3 | // Do not reorder inline modules. 4 | 5 | mod c; 6 | mod a { 7 | fn a() {} 8 | } 9 | mod b; 10 | -------------------------------------------------------------------------------- /tests/source/issue-2482/b.rs: -------------------------------------------------------------------------------- 1 | pub fn b() {} 2 | -------------------------------------------------------------------------------- /tests/source/issue-2482/c.rs: -------------------------------------------------------------------------------- 1 | pub fn c() {} 2 | -------------------------------------------------------------------------------- /tests/source/issue-2582.rs: -------------------------------------------------------------------------------- 1 | fn main() {} 2 | -------------------------------------------------------------------------------- /tests/source/issue-2641.rs: -------------------------------------------------------------------------------- 1 | macro_rules! a { 2 | () => {{}} 3 | } 4 | -------------------------------------------------------------------------------- /tests/source/issue-2644.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-max_width: 80 2 | fn foo(e: Enum) { 3 | match e { 4 | Enum::Var { 5 | element1, 6 | element2, 7 | } => { 8 | return; 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tests/source/issue-2728.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-wrap_comments: true 2 | // rustfmt-newline_style: Windows 3 | 4 | //! ```rust 5 | //! extern crate uom; 6 | //! ``` 7 | 8 | fn main() {} 9 | -------------------------------------------------------------------------------- /tests/source/issue-2794.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style: Block 2 | // rustfmt-imports_indent: Block 3 | // rustfmt-imports_layout: Vertical 4 | 5 | use std::{ 6 | env, fs, io::{Read, Write}, 7 | }; 8 | -------------------------------------------------------------------------------- /tests/source/issue-2835.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-brace_style: AlwaysNextLine 2 | // rustfmt-fn_single_line: true 3 | 4 | fn lorem() -> i32 5 | { 6 | 42 7 | } 8 | -------------------------------------------------------------------------------- /tests/source/issue-2916.rs: -------------------------------------------------------------------------------- 1 | a_macro!(name, 2 | ) ; 3 | -------------------------------------------------------------------------------- /tests/source/issue-2922.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style: Visual 2 | struct Functions { 3 | RunListenServer: unsafe extern "C" fn(*mut c_void, 4 | *mut c_char, 5 | *mut c_char, 6 | *mut c_char, 7 | *mut c_void, 8 | *mut c_void) -> c_int, 9 | } 10 | -------------------------------------------------------------------------------- /tests/source/issue-2927-2.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-edition: 2015 2 | #![feature(uniform_paths)] 3 | use futures::prelude::*; 4 | use http_03::cli::Cli; 5 | use hyper::{service::service_fn_ok, Body, Response, Server}; 6 | use ::log::{error, info, log}; 7 | use structopt::StructOpt; 8 | -------------------------------------------------------------------------------- /tests/source/issue-2927.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-edition: 2018 2 | #![feature(uniform_paths)] 3 | use futures::prelude::*; 4 | use http_03::cli::Cli; 5 | use hyper::{service::service_fn_ok, Body, Response, Server}; 6 | use ::log::{error, info, log}; 7 | use structopt::StructOpt; 8 | -------------------------------------------------------------------------------- /tests/source/issue-2930.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style: Visual 2 | fn main() { 3 | let (first_variable, second_variable) = (this_is_something_with_an_extraordinarily_long_name, 4 | this_variable_name_is_also_pretty_long); 5 | } 6 | -------------------------------------------------------------------------------- /tests/source/issue-2955.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-condense_wildcard_suffixes: true 2 | fn main() { 3 | match (1, 2, 3) { 4 | (_, _, _) => (), 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/issue-2995.rs: -------------------------------------------------------------------------------- 1 | fn issue_2995() { 2 | // '\u{2028}' is inserted in the code below. 3 | 4 | [0, 
1]; 5 | [0, 
/* */ 1]; 6 | 
[
0
,
1
]
; 7 | } 8 | -------------------------------------------------------------------------------- /tests/source/issue-3066.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style: Visual 2 | fn main() { 3 | Struct { field: aaaaaaaaaaa }; 4 | Struct { field: aaaaaaaaaaaa, }; 5 | Struct { field: value, 6 | field2: value2, }; 7 | } 8 | -------------------------------------------------------------------------------- /tests/source/issue-3131.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | match 3 { 3 | t if match t { 4 | _ => true, 5 | } => {}, 6 | _ => {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/source/issue-3217.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | let mut res = 0; 3 | 's_39: { if res == 0i32 { println!("Hello, world!"); } } 4 | 's_40: loop { println!("res = {}", res); res += 1; if res == 3i32 { break 's_40; } } 5 | let toto = || { if true { 42 } else { 24 } }; 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/issue-3241.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-edition: 2018 2 | 3 | use ::ignore; 4 | use ::ignore::some::more; 5 | use ::{foo, bar}; 6 | use ::*; 7 | use ::baz::{foo, bar}; 8 | 9 | fn main() { 10 | println!("Hello, world!"); 11 | } 12 | -------------------------------------------------------------------------------- /tests/source/issue-3253/bar.rs: -------------------------------------------------------------------------------- 1 | // Empty 2 | fn empty() { 3 | 4 | } 5 | -------------------------------------------------------------------------------- /tests/source/issue-3253/foo.rs: -------------------------------------------------------------------------------- 1 | pub fn hello( ) 2 | { 3 | println!("Hello World!"); 4 | 5 | } 6 | 7 | -------------------------------------------------------------------------------- /tests/source/issue-3253/paths/bar_foo.rs: -------------------------------------------------------------------------------- 1 | fn foo_decl_item(x: &mut i32) { 2 | x = 3; 3 | } 4 | -------------------------------------------------------------------------------- /tests/source/issue-3253/paths/foo_bar.rs: -------------------------------------------------------------------------------- 1 | 2 | 3 | fn Foo() where T: Bar { 4 | } 5 | -------------------------------------------------------------------------------- /tests/source/issue-3270/one.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2015 2 | 3 | pub fn main() { 4 | /* let s = String::from( 5 | " 6 | hello 7 | world 8 | ", 9 | ); */ 10 | 11 | assert_eq!(s, "\nhello\nworld\n"); 12 | } 13 | -------------------------------------------------------------------------------- /tests/source/issue-3270/two.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2024 2 | 3 | pub fn main() { 4 | /* let s = String::from( 5 | " 6 | hello 7 | world 8 | ", 9 | ); */ 10 | 11 | assert_eq!(s, "\nhello\nworld\n"); 12 | } 13 | -------------------------------------------------------------------------------- /tests/source/issue-3278/style_edition_2015.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2015 2 | 3 | pub fn parse_conditional<'a, I: 'a>( 4 | ) -> impl Parser + 'a 5 | where 6 | I: Stream, 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /tests/source/issue-3278/style_edition_2024.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2024 2 | 3 | pub fn parse_conditional<'a, I: 'a>() 4 | -> impl Parser + 'a 5 | where 6 | I: Stream, 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /tests/source/issue-3278/style_edition_2027.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2027 2 | 3 | pub fn parse_conditional<'a, I: 'a>() 4 | -> impl Parser + 'a 5 | where 6 | I: Stream, 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /tests/source/issue-3423.rs: -------------------------------------------------------------------------------- 1 | /* a nice comment with a trailing whitespace */ 2 | fn foo() {} 3 | 4 | /* a nice comment with a trailing tab */ 5 | fn bar() {} 6 | -------------------------------------------------------------------------------- /tests/source/issue-3434/not_skip_macro.rs: -------------------------------------------------------------------------------- 1 | #[this::is::not::skip::macros(ouch)] 2 | 3 | fn main() { 4 | let macro_result1 = ouch! {
5 | this should be mangled
6 | } 7 | .to_string(); 8 | } 9 | -------------------------------------------------------------------------------- /tests/source/issue-3515.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-reorder_imports: false 2 | 3 | use std :: fmt :: { self , Display } ; 4 | use std :: collections :: HashMap ; 5 | 6 | fn main() {} 7 | -------------------------------------------------------------------------------- /tests/source/issue-3532.rs: -------------------------------------------------------------------------------- 1 | fn foo(a: T) { 2 | match a { 3 | 1 => {} 4 | 0 => {} 5 | // _ => panic!("doesn't format!"), 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/source/issue-3585/use.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-inline_attribute_width: 100 2 | 3 | #[macro_use] 4 | use static_assertions; 5 | 6 | #[cfg(unix)] 7 | use static_assertions; 8 | -------------------------------------------------------------------------------- /tests/source/issue-3639.rs: -------------------------------------------------------------------------------- 1 | trait Foo where {} 2 | struct Bar where {} 3 | struct Bax where; 4 | struct Baz(String) where; 5 | impl<> Foo<> for Bar<> where {} 6 | -------------------------------------------------------------------------------- /tests/source/issue-3651.rs: -------------------------------------------------------------------------------- 1 | fn f() -> Box< 2 | dyn FnMut() -> Thing< WithType = LongItemName, Error = LONGLONGLONGLONGLONGONGEvenLongerErrorNameLongerLonger>, 3 | >{ 4 | } -------------------------------------------------------------------------------- /tests/source/issue-3665/not_skip_attribute.rs: -------------------------------------------------------------------------------- 1 | #![this::is::not::skip::attribute(ouch)] 2 | 3 | #[ouch(not, skip, me)] 4 | fn main() {} 5 | -------------------------------------------------------------------------------- /tests/source/issue-3672.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | let x = 5;; 3 | 4 | } -------------------------------------------------------------------------------- /tests/source/issue-3675.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | println!("{}" 3 | // comment 4 | , 111); 5 | } -------------------------------------------------------------------------------- /tests/source/issue-3709.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-edition: 2018 2 | 3 | macro_rules! token { 4 | ($t:tt) => {}; 5 | } 6 | 7 | fn main() { 8 | token!(dyn); 9 | token!(dyn ); 10 | } 11 | -------------------------------------------------------------------------------- /tests/source/issue-3750.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-imports_granularity: Crate 2 | 3 | pub mod foo { 4 | pub mod bar { 5 | pub struct Bar; 6 | } 7 | 8 | pub fn bar() {} 9 | } 10 | 11 | use foo::bar; 12 | use foo::bar::Bar; 13 | 14 | fn main() { 15 | bar(); 16 | } 17 | -------------------------------------------------------------------------------- /tests/source/issue-3751.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_code_in_doc_comments: true 2 | 3 | //! Empty pound line 4 | //! 5 | //! ```rust 6 | //! # 7 | //! # fn main() { 8 | //! foo ( ) ; 9 | //! # } 10 | //! ``` 11 | -------------------------------------------------------------------------------- /tests/source/issue-3779/ice.rs: -------------------------------------------------------------------------------- 1 | pub fn bar() { 2 | 1x; 3 | } 4 | -------------------------------------------------------------------------------- /tests/source/issue-3779/lib.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-unstable: true 2 | // rustfmt-config: issue-3779.toml 3 | 4 | #[path = "ice.rs"] 5 | mod ice; 6 | 7 | fn foo() { 8 | println!("abc") ; 9 | } 10 | -------------------------------------------------------------------------------- /tests/source/issue-4018.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | ; 3 | /* extra comment */ ; 4 | } 5 | 6 | fn main() { 7 | println!(""); 8 | // comment 1 9 | // comment 2 10 | // comment 3 11 | // comment 4 12 | ; 13 | } 14 | -------------------------------------------------------------------------------- /tests/source/issue-4381/style_edition_2015.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2015 2 | 3 | use std::num::{NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64}; 4 | -------------------------------------------------------------------------------- /tests/source/issue-4382.rs: -------------------------------------------------------------------------------- 1 | pub const NAME_MAX: usize = { 2 | #[cfg(target_os = "linux")] { 1024 } 3 | #[cfg(target_os = "freebsd")] { 255 } 4 | }; 5 | -------------------------------------------------------------------------------- /tests/source/issue-4530.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2024 2 | fn main() { 3 | let [aaaaaaaaaaaaaaaaaaaaaaaaaa, bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb, cccccccccccccccccccccccccc, ddddddddddddddddddddddddd] = panic!(); 4 | } 5 | -------------------------------------------------------------------------------- /tests/source/issue-4615/minimum_example.rs: -------------------------------------------------------------------------------- 1 | info!(//debug 2 | "{}: sending function_code={:04x} data={:04x} crc=0x{:04X} data={:02X?}", 3 | self.name, function_code, data, crc, output_cmd 4 | ); 5 | -------------------------------------------------------------------------------- /tests/source/issue-4656/format_me_please.rs: -------------------------------------------------------------------------------- 1 | 2 | pub fn hello( ) { } 3 | -------------------------------------------------------------------------------- /tests/source/issue-4656/lib.rs: -------------------------------------------------------------------------------- 1 | extern crate cfg_if; 2 | 3 | cfg_if::cfg_if! { 4 | if #[cfg(target_family = "unix")] { 5 | mod format_me_please; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/source/issue-4656/lib2.rs: -------------------------------------------------------------------------------- 1 | its_a_macro! { 2 | // Contents 3 | } 4 | -------------------------------------------------------------------------------- /tests/source/issue-4791/buggy.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-struct_field_align_threshold: 30 2 | // rustfmt-trailing_comma: Never 3 | 4 | struct Foo { 5 | group_a: u8, 6 | 7 | group_b: u8, 8 | } 9 | 10 | struct Bar { 11 | group_a: u8, 12 | 13 | group_b: u8 14 | } 15 | -------------------------------------------------------------------------------- /tests/source/issue-4791/trailing_comma.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-struct_field_align_threshold: 30 2 | // rustfmt-trailing_comma: Always 3 | 4 | struct Foo { 5 | group_a: u8, 6 | 7 | group_b: u8 8 | } 9 | 10 | struct Bar { 11 | group_a: u8, 12 | 13 | group_b: u8, 14 | } 15 | -------------------------------------------------------------------------------- /tests/source/issue-4808.rs: -------------------------------------------------------------------------------- 1 | trait Trait { 2 | fn method(&self) {} 3 | } 4 | 5 | impl T, T> Trait for F {} 6 | 7 | impl Trait for f32 {} 8 | 9 | fn main() { 10 | || 10. .method(); 11 | || .. .method(); 12 | || 1.. .method(); 13 | } 14 | -------------------------------------------------------------------------------- /tests/source/issue-4926/minimum_example.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-struct_field_align_threshold: 30 2 | 3 | struct X { a: i32, b: i32 } 4 | 5 | fn test(x: X) { 6 | let y = matches!(x, X { 7 | a: 1, 8 | .. 9 | }); 10 | } 11 | -------------------------------------------------------------------------------- /tests/source/issue-4984/minimum_example.rs: -------------------------------------------------------------------------------- 1 | #[derive(/*Debug, */Clone)] 2 | struct Foo; 3 | -------------------------------------------------------------------------------- /tests/source/issue-4984/multiple_comments_within.rs: -------------------------------------------------------------------------------- 1 | #[derive( 2 | /* ---------- Some really important comment that just had to go inside the derive --------- */ 3 | Debug, Clone,/* Another comment */Eq, PartialEq, 4 | )] 5 | struct Foo { 6 | a: i32, 7 | b: T, 8 | } 9 | -------------------------------------------------------------------------------- /tests/source/issue-5011.rs: -------------------------------------------------------------------------------- 1 | pub(crate) struct ASlash( 2 | // hello 3 | i32 4 | ); 5 | 6 | pub(crate) struct AStar( 7 | /* hello */ 8 | i32 9 | ); 10 | 11 | pub(crate) struct BStar(/* hello */ i32); 12 | 13 | -------------------------------------------------------------------------------- /tests/source/issue-5042/single-line_comment_with_trailing_comma.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | let _ = std::ops::Add::add(10, 20 3 | // ..., 4 | ); 5 | 6 | let _ = std::ops::Add::add(10, 20 7 | /* ... */, 8 | ); 9 | } 10 | -------------------------------------------------------------------------------- /tests/source/issue-5042/single-line_comment_without_trailing_comma.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | let _ = std::ops::Add::add(10, 20 3 | // ... 4 | ); 5 | 6 | let _ = std::ops::Add::add(10, 20 7 | /* ... */ 8 | ); 9 | } 10 | 11 | -------------------------------------------------------------------------------- /tests/source/issue-539.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-normalize_comments: true 2 | /* 3 | FIXME (#3300): Should allow items to be anonymous. Right now 4 | we just use dummy names for anon items. 5 | */ 6 | -------------------------------------------------------------------------------- /tests/source/issue-5655/one.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2015 2 | 3 | fn foo(_: T) 4 | where 5 | T: std::fmt::Debug, 6 | 7 | T: std::fmt::Display, 8 | { 9 | } 10 | -------------------------------------------------------------------------------- /tests/source/issue-5655/two.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2024 2 | 3 | fn foo(_: T) 4 | where 5 | T: std::fmt::Debug, 6 | 7 | T: std::fmt::Display, 8 | { 9 | } 10 | -------------------------------------------------------------------------------- /tests/source/issue-5791.rs: -------------------------------------------------------------------------------- 1 | pub fn main() { 2 | 0. .to_string(); 3 | } 4 | -------------------------------------------------------------------------------- /tests/source/issue-5835.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-wrap_comments: true 2 | 3 | /// . a 4 | pub fn foo() {} 5 | 6 | pub fn main() { 7 | // . a 8 | } 9 | -------------------------------------------------------------------------------- /tests/source/issue-5852/issue_example.rs: -------------------------------------------------------------------------------- 1 | use std::{ 2 | fs, 3 | // (temporarily commented, we'll need this again in a second) io, 4 | }; 5 | 6 | use foo::{ 7 | self // this is important 8 | }; 9 | -------------------------------------------------------------------------------- /tests/source/issue-5935.rs: -------------------------------------------------------------------------------- 1 | struct Regs< 2 | const BEGIN: u64, 3 | const END: u64, 4 | const DIM: usize, 5 | const N: usize = { (END - BEGIN) as usize / (8 * DIM) + 1 }, 6 | > 7 | { 8 | _foo: u64, 9 | } -------------------------------------------------------------------------------- /tests/source/issue-6059/repro.rs: -------------------------------------------------------------------------------- 1 | fn float_range_tests() { 2 | self.coords.x -= rng.gen_range(-self.radius / 2. .. self.radius / 2.); 3 | } 4 | -------------------------------------------------------------------------------- /tests/source/issue-683.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-normalize_comments: true 2 | /* 3 | * FIXME (#3300): Should allow items to be anonymous. Right now 4 | * we just use dummy names for anon items. 5 | */ 6 | -------------------------------------------------------------------------------- /tests/source/issue-850.rs: -------------------------------------------------------------------------------- 1 | const unsafe fn x() {} 2 | -------------------------------------------------------------------------------- /tests/source/issue-945.rs: -------------------------------------------------------------------------------- 1 | impl Bar { default const unsafe fn foo() { "hi" } } 2 | 3 | impl Baz { default unsafe extern "C" fn foo() { "hi" } } 4 | 5 | impl Foo for Bar { default fn foo() { "hi" } } 6 | -------------------------------------------------------------------------------- /tests/source/issue-977.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-normalize_comments: true 2 | 3 | trait NameC { /* comment */ } 4 | struct FooC { /* comment */ } 5 | enum MooC { /* comment */ } 6 | mod BarC { /* comment */ } 7 | extern { /* comment */ } 8 | -------------------------------------------------------------------------------- /tests/source/issue_3245.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | let x = 1; 3 | ;let y = 3; 4 | } 5 | -------------------------------------------------------------------------------- /tests/source/issue_3561.rs: -------------------------------------------------------------------------------- 1 | fn main() {;7 2 | } 3 | 4 | fn main() { 5 | ;7 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/issue_3839.rs: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | a: i32, 3 | /* 4 | asd 5 | */ 6 | // foo 7 | b: i32, 8 | } 9 | -------------------------------------------------------------------------------- /tests/source/issue_3844.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | || {{}}; 3 | } 4 | -------------------------------------------------------------------------------- /tests/source/issue_3868.rs: -------------------------------------------------------------------------------- 1 | fn foo() { 2 | ; 3 | } 4 | 5 | fn bar() { 6 | for _ in 0..1 { 7 | ; 8 | } 9 | } 10 | 11 | fn baz() { 12 | (); 13 | } -------------------------------------------------------------------------------- /tests/source/issue_4086.rs: -------------------------------------------------------------------------------- 1 | #[cfg(any())] 2 | extern "C++" {} 3 | -------------------------------------------------------------------------------- /tests/source/issue_4257.rs: -------------------------------------------------------------------------------- 1 | trait Trait { 2 | type Type<'a> where T: 'a; 3 | fn foo(x: &T) -> Self::Type<'_>; 4 | } 5 | impl Trait for () { 6 | type Type<'a> where T: 'a = &'a T; 7 | fn foo(x: &T) -> Self::Type<'_> { 8 | x 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tests/source/issue_4322.rs: -------------------------------------------------------------------------------- 1 | trait Bar { 2 | type X<'a> where Self: 'a; 3 | } 4 | -------------------------------------------------------------------------------- /tests/source/issue_4374.rs: -------------------------------------------------------------------------------- 1 | fn a(_f: F) -> () 2 | where 3 | F: FnOnce() -> (), 4 | { 5 | } 6 | fn main() { 7 | a(|| { 8 | #[allow(irrefutable_let_patterns)] 9 | while let _ = 0 { 10 | break; 11 | } 12 | }); 13 | } -------------------------------------------------------------------------------- /tests/source/issue_4528.rs: -------------------------------------------------------------------------------- 1 | #![allow(clippy::no_effect)] 2 | 3 | extern "C" { 4 | // N.B., mutability can be easily incorrect in FFI calls -- as 5 | // in C, the default is mutable pointers. 6 | fn ffi(c: *mut u8); 7 | fn int_ffi(c: *mut i32); 8 | } -------------------------------------------------------------------------------- /tests/source/issue_4675.rs: -------------------------------------------------------------------------------- 1 | macro_rules! foo { 2 | ($s:ident ( $p:pat )) => { 3 | Foo { 4 | name: Name::$s($p), 5 | .. 6 | } 7 | }; 8 | } -------------------------------------------------------------------------------- /tests/source/issue_4823.rs: -------------------------------------------------------------------------------- 1 | macro_rules! m { 2 | () => { 3 | type Type; 4 | }; 5 | } 6 | -------------------------------------------------------------------------------- /tests/source/issue_4911.rs: -------------------------------------------------------------------------------- 1 | #![feature(min_type_alias_impl_trait)] 2 | 3 | impl SomeTrait for SomeType { 4 | type SomeGAT<'a> where Self: 'a = impl SomeOtherTrait; 5 | } -------------------------------------------------------------------------------- /tests/source/issue_4943.rs: -------------------------------------------------------------------------------- 1 | impl SomeStruct { 2 | fn process(v: T) -> ::R 3 | where Self: GAT = T> 4 | { 5 | SomeStruct::do_something(v) 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/source/issue_4954.rs: -------------------------------------------------------------------------------- 1 | trait Foo { 2 | type Arg<'a>; 3 | } 4 | 5 | struct Bar(T) where for<'a> T: Foo = ()>; 6 | -------------------------------------------------------------------------------- /tests/source/issue_4963.rs: -------------------------------------------------------------------------------- 1 | mod test { 2 | extern "C" {fn test();} 3 | } 4 | 5 | extern "C" {fn test();} -------------------------------------------------------------------------------- /tests/source/issue_5086.rs: -------------------------------------------------------------------------------- 1 | #[cfg(any())] 2 | type Type : Bound ; -------------------------------------------------------------------------------- /tests/source/issue_5721.rs: -------------------------------------------------------------------------------- 1 | #![feature(non_lifetime_binders)] 2 | #![allow(incomplete_features)] 3 | 4 | trait Other {} 5 | 6 | trait Trait 7 | where 8 | for U: Other {} 9 | -------------------------------------------------------------------------------- /tests/source/issue_5730.rs: -------------------------------------------------------------------------------- 1 | macro_rules! statement { 2 | () => {;}; 3 | } 4 | -------------------------------------------------------------------------------- /tests/source/issue_5735.rs: -------------------------------------------------------------------------------- 1 | fn find_errors(mut self) { 2 | let errors: Vec<> = vec!{ 3 | #[debug_format = "A({})"] 4 | struct A {} 5 | }; 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/issue_5882.rs: -------------------------------------------------------------------------------- 1 | macro_rules!foo{} 2 | macro_rules!bar{/*comment*/} 3 | macro_rules!baz{//comment 4 | } 5 | macro_rules!foobar{ 6 | //comment 7 | } 8 | -------------------------------------------------------------------------------- /tests/source/large-block.rs: -------------------------------------------------------------------------------- 1 | fn issue1351() { 2 | std_fmt_Arguments_new_v1_std_rt_begin_panic_fmt_sdfasfasdfasdf({ 3 | static __STATIC_FMTSTR: &'static [&'static str] = &[]; 4 | }); 5 | } 6 | -------------------------------------------------------------------------------- /tests/source/long-use-statement-issue-3154.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-reorder_imports: false 2 | 3 | pub use self :: super :: super :: super :: root::mozilla::detail::StringClassFlags as nsTStringRepr_ClassFlags ; 4 | -------------------------------------------------------------------------------- /tests/source/long_field_access.rs: -------------------------------------------------------------------------------- 1 | fn f() { 2 | block_flow.base.stacking_relative_position_of_display_port = self.base.stacking_relative_position_of_display_port; 3 | } 4 | -------------------------------------------------------------------------------- /tests/source/macro_not_expr.rs: -------------------------------------------------------------------------------- 1 | macro_rules! test { 2 | ($($t:tt)*) => {} 3 | } 4 | 5 | fn main() { 6 | test!( a : B => c d ); 7 | } 8 | -------------------------------------------------------------------------------- /tests/source/macros/rewrite-const-item.rs: -------------------------------------------------------------------------------- 1 | m!(const N: usize = 0;); 2 | -------------------------------------------------------------------------------- /tests/source/max-line-length-in-chars.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-max_width: 25 2 | 3 | // абвгдеёжзийклмнопрст 4 | fn main() {} 5 | -------------------------------------------------------------------------------- /tests/source/merge_imports_true_compat.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-merge_imports: true 2 | 3 | use a::b; 4 | use a::c; -------------------------------------------------------------------------------- /tests/source/mod-2.rs: -------------------------------------------------------------------------------- 1 | // Some nested mods 2 | 3 | #[cfg(test)] mod nestedmod ; 4 | pub mod no_new_line_beginning; 5 | -------------------------------------------------------------------------------- /tests/source/mod_skip_child.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-skip_children: true 2 | mod nested_skipped; 3 | -------------------------------------------------------------------------------- /tests/source/nested-if-else.rs: -------------------------------------------------------------------------------- 1 | fn issue1518() { 2 | Some(Object { 3 | field: if a { 4 | a_thing 5 | } else if b { 6 | b_thing 7 | } else { 8 | c_thing 9 | }, 10 | }) 11 | } 12 | -------------------------------------------------------------------------------- /tests/source/nested_skipped/mod.rs: -------------------------------------------------------------------------------- 1 | fn ugly() { 2 | 92; 3 | } 4 | -------------------------------------------------------------------------------- /tests/source/nestedmod/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | mod mod2a; 3 | mod mod2b; 4 | 5 | mod mymod1 { 6 | use mod2a::{Foo,Bar}; 7 | mod mod3a; 8 | } 9 | 10 | #[path="mod2c.rs"] 11 | mod mymod2; 12 | 13 | mod submod2; 14 | -------------------------------------------------------------------------------- /tests/source/nestedmod/mod2a.rs: -------------------------------------------------------------------------------- 1 | // This is an empty file containing only 2 | // comments 3 | 4 | // ................... 5 | -------------------------------------------------------------------------------- /tests/source/nestedmod/mod2b.rs: -------------------------------------------------------------------------------- 1 | 2 | #[path="mod2a.rs"] 3 | mod c; 4 | -------------------------------------------------------------------------------- /tests/source/nestedmod/mod2c.rs: -------------------------------------------------------------------------------- 1 | // A standard mod 2 | 3 | fn a( ) {} 4 | -------------------------------------------------------------------------------- /tests/source/nestedmod/mymod1/mod3a.rs: -------------------------------------------------------------------------------- 1 | // Another mod 2 | fn a( ) { } 3 | -------------------------------------------------------------------------------- /tests/source/nestedmod/submod2/a.rs: -------------------------------------------------------------------------------- 1 | // Yet Another mod 2 | // Nested 3 | 4 | use c::a; 5 | 6 | fn foo( ) { } 7 | -------------------------------------------------------------------------------- /tests/source/nestedmod/submod2/mod.rs: -------------------------------------------------------------------------------- 1 | // Another mod 2 | 3 | mod a; 4 | 5 | use a::a; 6 | -------------------------------------------------------------------------------- /tests/source/no_arg_with_comment.rs: -------------------------------------------------------------------------------- 1 | fn foo( /* comment */ 2 | ) {} 3 | -------------------------------------------------------------------------------- /tests/source/no_new_line_beginning.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | } 3 | -------------------------------------------------------------------------------- /tests/source/non-lifetime-binders.rs: -------------------------------------------------------------------------------- 1 | fn main() where for<'a, T: Sized + 'a, const C: usize> [&'a T; C]: Sized { 2 | let x = for 3 | || {}; 4 | 5 | let y: dyn 6 | for Into; 7 | 8 | let z: for 9 | fn(T); 10 | } 11 | -------------------------------------------------------------------------------- /tests/source/other.rs: -------------------------------------------------------------------------------- 1 | // Part of multiple.rs 2 | 3 | fn bob() { 4 | println!("hello other!"); 5 | } 6 | -------------------------------------------------------------------------------- /tests/source/paren.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | let x = (((1))); 3 | let y = (/* comment */((2))); 4 | let z = (((3)/* comment */)); 5 | let a = (((4/* comment */))); 6 | } 7 | -------------------------------------------------------------------------------- /tests/source/path_clarity/foo.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-edition: 2018 2 | mod bar; 3 | -------------------------------------------------------------------------------- /tests/source/path_clarity/foo/bar.rs: -------------------------------------------------------------------------------- 1 | pub fn fn_in_bar( ) { 2 | println!( "foo/bar.rs" ); 3 | } 4 | -------------------------------------------------------------------------------- /tests/source/preserves_carriage_return_for_unix.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-newline_style: Unix 2 | // Foo Bar 3 | -------------------------------------------------------------------------------- /tests/source/preserves_carriage_return_for_windows.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-newline_style: Windows 2 | // Foo Bar 3 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/A2/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/ABCD/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/ZYXW/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/ZYXW_/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/ZY_XW/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/Z_YXW/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/_ZYXW/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/_abcd/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/a1/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/abcd/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/u128/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/u16/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/u256/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/u32/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/u64/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/u8/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/u_zzz/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/ua/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/usize/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/uz/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/v0/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/v00/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/v000/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/v001/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/v009/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/v00t/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/v01/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/v010/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/v09/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/v0s/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/v0u/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/v1/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/v10/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/v9/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/w005s09t/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/w5s009t/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/x64/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/x86/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/x86_128/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/x86_32/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/x86_64/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/x87/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/reorder_modules/zyxw/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/source/skip_macro_invocations/all.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-skip_macro_invocations: ["*"] 2 | 3 | // Should skip this invocation 4 | items!( 5 | const _: u8 = 0; 6 | ); 7 | 8 | // Should skip this invocation 9 | renamed_items!( 10 | const _: u8 = 0; 11 | ); 12 | -------------------------------------------------------------------------------- /tests/source/skip_macro_invocations/config_file.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-unstable: true 2 | // rustfmt-config: issue-5816.toml 3 | 4 | fn main() { 5 | println!( "Hello, world!"); 6 | let x = 7 | 7 8 | ; 9 | } 10 | -------------------------------------------------------------------------------- /tests/source/skip_macro_invocations/name_unknown.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-skip_macro_invocations: ["unknown"] 2 | 3 | // Should not skip this invocation 4 | items!( 5 | const _: u8 = 0; 6 | ); 7 | -------------------------------------------------------------------------------- /tests/source/skip_macro_invocations/path_qualified_invocation_mismatch.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-skip_macro_invocations: ["items"] 2 | 3 | // Should not skip this invocation 4 | self::items!( 5 | const _: u8 = 0; 6 | ); 7 | -------------------------------------------------------------------------------- /tests/source/skip_macro_invocations/path_qualified_match.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-skip_macro_invocations: ["self::items"] 2 | 3 | // Should skip this invocation 4 | self::items!( 5 | const _: u8 = 0; 6 | ); 7 | -------------------------------------------------------------------------------- /tests/source/skip_macro_invocations/path_qualified_name_mismatch.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-skip_macro_invocations: ["self::items"] 2 | 3 | // Should not skip this invocation 4 | items!( 5 | const _: u8 = 0; 6 | ); 7 | -------------------------------------------------------------------------------- /tests/source/space-not-before-newline.rs: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | a: (), 3 | // spaces ^^^ to be removed 4 | } 5 | enum Foo { 6 | Bar, 7 | // spaces ^^^ to be removed 8 | } 9 | -------------------------------------------------------------------------------- /tests/source/tuple_v2.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2024 2 | 3 | fn issue_4355() { 4 | let _ = ((1,),).0 .0; 5 | } 6 | -------------------------------------------------------------------------------- /tests/source/unsafe-mod.rs: -------------------------------------------------------------------------------- 1 | // These are supported by rustc syntactically but not semantically. 2 | 3 | #[cfg(any())] 4 | unsafe mod m { } 5 | 6 | #[cfg(any())] 7 | unsafe extern "C++" { } 8 | -------------------------------------------------------------------------------- /tests/source/visibility.rs: -------------------------------------------------------------------------------- 1 | // #2398 2 | pub mod outer_mod { 3 | pub mod inner_mod { 4 | pub ( in outer_mod ) fn outer_mod_visible_fn() {} 5 | pub ( super ) fn super_mod_visible_fn() {} 6 | pub ( self ) fn inner_mod_visible_fn() {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/5131_crate.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-imports_granularity: Crate 2 | 3 | use foo::{ 4 | a, b, b as b2, 5 | b::{f, g, g as g2}, 6 | c, 7 | d::e, 8 | }; 9 | use qux::{h, h as h2, i}; 10 | -------------------------------------------------------------------------------- /tests/target/5131_one.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-imports_granularity: One 2 | 3 | pub use foo::{x, x as x2, y}; 4 | use { 5 | bar::{ 6 | a, 7 | b::{self, f, g}, 8 | c, 9 | d::{e, e as e2}, 10 | }, 11 | qux::{h, i}, 12 | }; 13 | -------------------------------------------------------------------------------- /tests/target/arrow_in_comments/arrow_in_single_comment.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2024 2 | fn main() { 3 | match a { 4 | _ => 5 | // comment with => 6 | { 7 | println!("A") 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tests/target/associated-items.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | println!("{}", ::default()); 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/associated-types-bounds-wrapping.rs: -------------------------------------------------------------------------------- 1 | // Test proper wrapping of long associated type bounds 2 | 3 | pub trait HttpService { 4 | type WsService: 'static 5 | + Service; 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/associated_type_defaults.rs: -------------------------------------------------------------------------------- 1 | #![feature(associated_type_defaults)] 2 | trait Foo { 3 | type Bar = (); 4 | } 5 | -------------------------------------------------------------------------------- /tests/target/asyncness.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-edition: 2018 2 | 3 | fn foo() -> impl async Fn() {} 4 | 5 | fn bar() -> impl for<'a> async Fn(&'a ()) {} 6 | -------------------------------------------------------------------------------- /tests/target/cfg_if/detect/os/other.rs: -------------------------------------------------------------------------------- 1 | //! Other operating systems 2 | 3 | use crate::detect::Feature; 4 | 5 | /// Performs run-time feature detection. 6 | #[inline] 7 | pub fn check_for(_x: Feature) -> bool { 8 | false 9 | } 10 | -------------------------------------------------------------------------------- /tests/target/cfg_if/mod.rs: -------------------------------------------------------------------------------- 1 | //! `std_detect` 2 | 3 | #[doc(hidden)] // unstable implementation detail 4 | #[unstable(feature = "stdsimd", issue = "27731")] 5 | pub mod detect; 6 | -------------------------------------------------------------------------------- /tests/target/cfg_match/format_me_please_1.rs: -------------------------------------------------------------------------------- 1 | pub fn format_me_please_1() {} 2 | -------------------------------------------------------------------------------- /tests/target/cfg_match/format_me_please_2.rs: -------------------------------------------------------------------------------- 1 | pub fn format_me_please_2() {} 2 | -------------------------------------------------------------------------------- /tests/target/cfg_match/format_me_please_3.rs: -------------------------------------------------------------------------------- 1 | pub fn format_me_please_3() {} 2 | -------------------------------------------------------------------------------- /tests/target/cfg_match/format_me_please_4.rs: -------------------------------------------------------------------------------- 1 | pub fn format_me_please_4() {} 2 | -------------------------------------------------------------------------------- /tests/target/cfg_match/lib2.rs: -------------------------------------------------------------------------------- 1 | its_a_macro! { 2 | // Contents 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/cfg_mod/bar.rs: -------------------------------------------------------------------------------- 1 | fn bar() -> &str { 2 | "bar" 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/cfg_mod/dir/dir1/dir2/wasm32.rs: -------------------------------------------------------------------------------- 1 | fn wasm32() -> &str { 2 | "wasm32" 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/cfg_mod/dir/dir1/dir3/wasm32.rs: -------------------------------------------------------------------------------- 1 | fn wasm32() -> &str { 2 | "wasm32" 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/cfg_mod/foo.rs: -------------------------------------------------------------------------------- 1 | fn foo() -> &str { 2 | "foo" 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/cfg_mod/other.rs: -------------------------------------------------------------------------------- 1 | fn other() -> &str { 2 | "other" 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/cfg_mod/wasm32.rs: -------------------------------------------------------------------------------- 1 | fn wasm32() -> &str { 2 | "wasm32" 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/comment2.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-wrap_comments: true 2 | 3 | /// This is a long line that angers rustfmt. Rustfmt shall deal with it swiftly 4 | /// and justly. 5 | pub mod foo {} 6 | -------------------------------------------------------------------------------- /tests/target/comment3.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-wrap_comments: true 2 | 3 | //! This is a long line that angers rustfmt. Rustfmt shall deal with it swiftly 4 | //! and justly. 5 | 6 | pub mod foo {} 7 | -------------------------------------------------------------------------------- /tests/target/comment_crlf_newline.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-normalize_comments: true 2 | // Block comments followed by CRLF newlines should not an extra newline at the end 3 | 4 | // Something else 5 | -------------------------------------------------------------------------------- /tests/target/configs/blank_lines_lower_bound/1.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-blank_lines_lower_bound: 1 2 | 3 | fn foo() {} 4 | 5 | fn bar() {} 6 | 7 | // comment 8 | fn foobar() {} 9 | 10 | fn foo1() {} 11 | 12 | fn bar1() {} 13 | 14 | // comment 15 | 16 | fn foobar1() {} 17 | -------------------------------------------------------------------------------- /tests/target/configs/comment_width/above.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-comment_width: 40 2 | // rustfmt-wrap_comments: true 3 | // Comment width 4 | 5 | fn main() { 6 | // Lorem ipsum dolor sit amet, 7 | // consectetur adipiscing elit. 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/configs/comment_width/below.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-comment_width: 80 2 | // rustfmt-wrap_comments: true 3 | // Comment width 4 | 5 | fn main() { 6 | // Lorem ipsum dolor sit amet, consectetur adipiscing elit. 7 | } 8 | -------------------------------------------------------------------------------- /tests/target/configs/comment_width/ignore.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-comment_width: 40 2 | // rustfmt-wrap_comments: false 3 | // Comment width 4 | 5 | fn main() { 6 | // Lorem ipsum dolor sit amet, consectetur adipiscing elit. 7 | } 8 | -------------------------------------------------------------------------------- /tests/target/configs/condense_wildcard_suffixes/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-condense_wildcard_suffixes: false 2 | // Condense wildcard suffixes 3 | 4 | fn main() { 5 | let (lorem, ipsum, _, _) = (1, 2, 3, 4); 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/configs/condense_wildcard_suffixes/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-condense_wildcard_suffixes: true 2 | // Condense wildcard suffixes 3 | 4 | fn main() { 5 | let (lorem, ipsum, ..) = (1, 2, 3, 4); 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/configs/disable_all_formatting/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-disable_all_formatting: false 2 | // Disable all formatting 3 | 4 | fn main() { 5 | if lorem { 6 | println!("ipsum!"); 7 | } else { 8 | println!("dolor!"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tests/target/configs/disable_all_formatting/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-disable_all_formatting: true 2 | // Disable all formatting 3 | 4 | fn main() { 5 | if lorem{println!("ipsum!");}else{println!("dolor!");} 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/configs/empty_item_single_line/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-empty_item_single_line: false 2 | // Empty impl on single line 3 | 4 | impl Lorem { 5 | } 6 | 7 | impl Ipsum { 8 | } 9 | 10 | fn lorem() { 11 | } 12 | 13 | fn lorem() { 14 | } 15 | -------------------------------------------------------------------------------- /tests/target/configs/empty_item_single_line/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-empty_item_single_line: true 2 | // Empty impl on single line 3 | 4 | impl Lorem {} 5 | 6 | impl Ipsum {} 7 | 8 | fn lorem() {} 9 | 10 | fn lorem() {} 11 | -------------------------------------------------------------------------------- /tests/target/configs/error_on_line_overflow/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-error_on_line_overflow: false 2 | // Error on line overflow 3 | 4 | fn main() { 5 | let lorem_ipsum_dolor_sit_amet_consectetur_adipiscing_elit_lorem_ipsum_dolor_sit_amet_consectetur_adipiscing_elit; 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/configs/fn_single_line/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-fn_single_line: false 2 | // Single-expression function on single line 3 | 4 | fn lorem() -> usize { 5 | 42 6 | } 7 | 8 | fn lorem() -> usize { 9 | let ipsum = 42; 10 | ipsum 11 | } 12 | -------------------------------------------------------------------------------- /tests/target/configs/fn_single_line/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-fn_single_line: true 2 | // Single-expression function on single line 3 | 4 | fn lorem() -> usize { 42 } 5 | 6 | fn lorem() -> usize { 7 | let ipsum = 42; 8 | ipsum 9 | } 10 | -------------------------------------------------------------------------------- /tests/target/configs/force_explicit_abi/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-force_explicit_abi: false 2 | // Force explicit abi 3 | 4 | extern { 5 | pub static lorem: c_int; 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/configs/force_explicit_abi/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-force_explicit_abi: true 2 | // Force explicit abi 3 | 4 | extern "C" { 5 | pub static lorem: c_int; 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/configs/format_generated_files/false.rs: -------------------------------------------------------------------------------- 1 | // @generated 2 | // rustfmt-format_generated_files: false 3 | 4 | fn main() 5 | { 6 | println!("hello, world") 7 | ; 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/configs/format_generated_files/false_with_marker_out_scope_size.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_generated_files: false 2 | // rustfmt-generated_marker_line_search_limit: 1 3 | 4 | fn main() { 5 | println!("hello, world"); 6 | } 7 | 8 | // @generated 9 | -------------------------------------------------------------------------------- /tests/target/configs/format_generated_files/false_with_zero_search_limit.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_generated_files: false 2 | // rustfmt-generated_marker_line_search_limit: 0 3 | 4 | // @generated 5 | fn main() { 6 | println!("hello, world"); 7 | } 8 | // @generated 9 | -------------------------------------------------------------------------------- /tests/target/configs/format_generated_files/true.rs: -------------------------------------------------------------------------------- 1 | // @generated 2 | // rustfmt-format_generated_files: true 3 | 4 | fn main() { 5 | println!("hello, world"); 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/configs/format_generated_files/true_with_marker_in_scope_size.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_generated_files: true 2 | // rustfmt-generated_marker_line_search_limit: 20 3 | 4 | fn main() { 5 | println!("hello, world"); 6 | } 7 | 8 | // @generated 9 | -------------------------------------------------------------------------------- /tests/target/configs/format_generated_files/true_with_marker_not_in_header.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_generated_files: true 2 | 3 | fn main() { 4 | println!("hello, world"); 5 | } 6 | 7 | // @generated 8 | -------------------------------------------------------------------------------- /tests/target/configs/format_macro_bodies/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_macro_bodies: false 2 | 3 | macro_rules! foo { 4 | ($a: ident : $b: ty) => { $a(42): $b; }; 5 | ($a: ident $b: ident $c: ident) => { $a=$b+$c; }; 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/configs/format_macro_bodies/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_macro_bodies: true 2 | 3 | macro_rules! foo { 4 | ($a: ident : $b: ty) => { $a(42): $b; }; 5 | ($a: ident $b: ident $c: ident) => { $a=$b+$c; }; 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/configs/format_macro_matchers/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_macro_matchers: false 2 | 3 | macro_rules! foo { 4 | ($a: ident : $b: ty) => { $a(42): $b; }; 5 | ($a: ident $b: ident $c: ident) => { $a=$b+$c; }; 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/configs/format_macro_matchers/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_macro_matchers: true 2 | 3 | macro_rules! foo { 4 | ($a: ident : $b: ty) => { $a(42): $b; }; 5 | ($a: ident $b: ident $c: ident) => { $a=$b+$c; }; 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/configs/group_imports/One-nested.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-group_imports: One 2 | mod test { 3 | use crate::foo::bar; 4 | use crate::foo::bar2; 5 | use std::path; 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/configs/group_imports/StdExternalCrate-nested.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-group_imports: StdExternalCrate 2 | mod test { 3 | use std::path; 4 | 5 | use crate::foo::bar; 6 | use crate::foo::bar2; 7 | } 8 | -------------------------------------------------------------------------------- /tests/target/configs/hard_tabs/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-hard_tabs: false 2 | // Hard tabs 3 | 4 | fn lorem() -> usize { 5 | 42 // spaces before 42 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/configs/hard_tabs/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-hard_tabs: true 2 | // Hard tabs 3 | 4 | fn lorem() -> usize { 5 | 42 // spaces before 42 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/configs/imports_layout/merge_mixed.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-imports_indent: Block 2 | // rustfmt-imports_granularity: Crate 3 | // rustfmt-imports_layout: Mixed 4 | 5 | use std::{fmt, io, str, str::FromStr}; 6 | -------------------------------------------------------------------------------- /tests/target/configs/indent_style/block_struct_lit.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style: Block 2 | // Struct literal-style 3 | 4 | fn main() { 5 | let lorem = Lorem { 6 | ipsum: dolor, 7 | sit: amet, 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /tests/target/configs/indent_style/default.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style: Visual 2 | // Where style 3 | 4 | fn lorem() -> T 5 | where Ipsum: Eq, 6 | Dolor: Eq, 7 | Sit: Eq, 8 | Amet: Eq 9 | { 10 | // body 11 | } 12 | -------------------------------------------------------------------------------- /tests/target/configs/indent_style/rfc_where.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style: Block 2 | // Where style 3 | 4 | fn lorem() -> T 5 | where 6 | Ipsum: Eq, 7 | Dolor: Eq, 8 | Sit: Eq, 9 | Amet: Eq, 10 | { 11 | // body 12 | } 13 | -------------------------------------------------------------------------------- /tests/target/configs/indent_style/visual_struct_lit.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style: Visual 2 | // Struct literal-style 3 | 4 | fn main() { 5 | let lorem = Lorem { ipsum: dolor, 6 | sit: amet }; 7 | } 8 | -------------------------------------------------------------------------------- /tests/target/configs/remove_nested_parens/remove_nested_parens.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-remove_nested_parens: true 2 | 3 | fn main() { 4 | (foo()); 5 | } 6 | -------------------------------------------------------------------------------- /tests/target/configs/reorder_impl_items/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-reorder_impl_items: false 2 | 3 | struct Dummy; 4 | 5 | impl Iterator for Dummy { 6 | fn next(&mut self) -> Option { 7 | None 8 | } 9 | 10 | type Item = i32; 11 | } 12 | -------------------------------------------------------------------------------- /tests/target/configs/reorder_impl_items/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-reorder_impl_items: true 2 | 3 | struct Dummy; 4 | 5 | impl Iterator for Dummy { 6 | type Item = i32; 7 | 8 | fn next(&mut self) -> Option { 9 | None 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /tests/target/configs/reorder_imports/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-reorder_imports: false 2 | // Reorder imports 3 | 4 | use lorem; 5 | use ipsum; 6 | use dolor; 7 | use sit; 8 | -------------------------------------------------------------------------------- /tests/target/configs/reorder_modules/dolor/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/configs/reorder_modules/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-reorder_modules: false 2 | // Reorder modules 3 | 4 | mod lorem; 5 | mod ipsum; 6 | mod dolor; 7 | mod sit; 8 | -------------------------------------------------------------------------------- /tests/target/configs/reorder_modules/ipsum/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/configs/reorder_modules/lorem/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/configs/reorder_modules/sit/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/configs/reorder_modules/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-reorder_modules: true 2 | // Reorder modules 3 | 4 | mod dolor; 5 | mod ipsum; 6 | mod lorem; 7 | mod sit; 8 | -------------------------------------------------------------------------------- /tests/target/configs/skip_children/foo/mod.rs: -------------------------------------------------------------------------------- 1 | fn skip_formatting_this() { 2 | println ! ( "Skip this" ) ; 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/configs/skip_children/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-skip_children: true 2 | 3 | mod foo; 4 | mod void; 5 | -------------------------------------------------------------------------------- /tests/target/configs/space_before_colon/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-space_before_colon: true 2 | // Space before colon 3 | 4 | fn lorem(t : T) { 5 | let ipsum : Dolor = sit; 6 | } 7 | 8 | const LOREM : Lorem = Lorem { 9 | ipsum : dolor, 10 | sit : amet, 11 | }; 12 | -------------------------------------------------------------------------------- /tests/target/configs/struct_lit_single_line/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-struct_lit_single_line: false 2 | // Struct literal multiline-style 3 | 4 | fn main() { 5 | let lorem = Lorem { 6 | ipsum: dolor, 7 | sit: amet, 8 | }; 9 | } 10 | -------------------------------------------------------------------------------- /tests/target/configs/use_try_shorthand/false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-use_try_shorthand: false 2 | // Use try! shorthand 3 | 4 | fn main() { 5 | let lorem = try!(ipsum.map(|dolor| dolor.sit())); 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/configs/use_try_shorthand/true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-use_try_shorthand: true 2 | // Use try! shorthand 3 | 4 | fn main() { 5 | let lorem = ipsum.map(|dolor| dolor.sit())?; 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/doc.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-normalize_comments: true 2 | // Part of multiple.rs 3 | 4 | // sadfsdfa 5 | // sdffsdfasdf 6 | -------------------------------------------------------------------------------- /tests/target/empty-tuple-no-conversion-to-unit-struct.rs: -------------------------------------------------------------------------------- 1 | enum TestEnum { 2 | Arm1(), 3 | Arm2, 4 | } 5 | 6 | fn foo() { 7 | let test = TestEnum::Arm1; 8 | match test { 9 | TestEnum::Arm1() => {} 10 | TestEnum::Arm2 => {} 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /tests/target/empty_file.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/extern-rust.rs: -------------------------------------------------------------------------------- 1 | extern "Rust" fn uwu() {} 2 | -------------------------------------------------------------------------------- /tests/target/fn_once.rs: -------------------------------------------------------------------------------- 1 | struct Add(usize); 2 | 3 | impl FnOnce<(usize,)> for Add { 4 | type Output = Add; 5 | extern "rust-call" fn call_once(self, to: (usize,)) -> Add { 6 | Add(self.0 + to.0) 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/format_strings/issue564.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_strings: true 2 | 3 | const USAGE: &'static str = " 4 | Usage: codegen project 5 | codegen regenerate 6 | codegen verify 7 | "; 8 | -------------------------------------------------------------------------------- /tests/target/hello.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-config: small_tabs.toml 2 | // rustfmt-target: hello.rs 3 | 4 | // Smoke test - hello world. 5 | 6 | fn main() { 7 | println!("Hello world!"); 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/hex_literal_lower.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-hex_literal_case: Lower 2 | fn main() { 3 | let h1 = 0xcafe_5ea7; 4 | let h2 = 0xcafe_f00du32; 5 | } 6 | -------------------------------------------------------------------------------- /tests/target/hex_literal_preserve.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-hex_literal_case: Preserve 2 | fn main() { 3 | let h1 = 0xcAfE_5Ea7; 4 | let h2 = 0xCaFe_F00du32; 5 | } 6 | -------------------------------------------------------------------------------- /tests/target/hex_literal_upper.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-hex_literal_case: Upper 2 | fn main() { 3 | let h1 = 0xCAFE_5EA7; 4 | let h2 = 0xCAFE_F00Du32; 5 | } 6 | -------------------------------------------------------------------------------- /tests/target/immovable_coroutines.rs: -------------------------------------------------------------------------------- 1 | #![feature(coroutines)] 2 | 3 | unsafe fn foo() { 4 | let mut ga = #[coroutine] 5 | static || { 6 | yield 1; 7 | }; 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/imports/imports-impl-only-use.rs: -------------------------------------------------------------------------------- 1 | #![feature(underscore_imports)] 2 | 3 | use attr; 4 | use std::iter::Iterator as _; 5 | -------------------------------------------------------------------------------- /tests/target/imports/imports-reorder.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-normalize_comments: true 2 | 3 | use path::{self /* self */, /* A */ A, B /* B */, C}; 4 | 5 | use {aa, ab, ac, b, Z}; 6 | -------------------------------------------------------------------------------- /tests/target/imports/imports_2021_edition.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-edition: 2021 2 | 3 | use ::happy::new::year; 4 | -------------------------------------------------------------------------------- /tests/target/imports/imports_block_indent.rs: -------------------------------------------------------------------------------- 1 | // #2569 2 | use apns2::request::notification::{ 3 | Notificatio, NotificationBuilder, Priority, SilentNotificationBuilder, 4 | }; 5 | -------------------------------------------------------------------------------- /tests/target/imports/imports_granularity_default-with-dups.rs: -------------------------------------------------------------------------------- 1 | use crate::lexer; 2 | use crate::lexer; 3 | use crate::lexer::tokens::TokenData; 4 | use crate::lexer::tokens::TokenData; 5 | use crate::lexer::{self}; 6 | use crate::lexer::{self, tokens::TokenData}; 7 | -------------------------------------------------------------------------------- /tests/target/imports/imports_granularity_item-with-dups.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-imports_granularity: Item 2 | 3 | use crate::lexer; 4 | use crate::lexer::tokens::TokenData; 5 | use crate::lexer::{self}; 6 | -------------------------------------------------------------------------------- /tests/target/imports_raw_identifiers/version_One.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-version:One 2 | 3 | use websocket::client::ClientBuilder; 4 | use websocket::r#async::futures::Stream; 5 | use websocket::result::WebSocketError; 6 | -------------------------------------------------------------------------------- /tests/target/imports_raw_identifiers/version_Two.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-version:Two 2 | 3 | use websocket::r#async::futures::Stream; 4 | use websocket::client::ClientBuilder; 5 | use websocket::result::WebSocketError; 6 | -------------------------------------------------------------------------------- /tests/target/indented-impl.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-brace_style: AlwaysNextLine 2 | mod x 3 | { 4 | struct X(i8); 5 | 6 | impl Y for X 7 | { 8 | fn y(self) -> () 9 | { 10 | println!("ok"); 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /tests/target/inner-module-path/b.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/inner-module-path/c/d.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/inner-module-path/lib.rs: -------------------------------------------------------------------------------- 1 | #[path = "."] 2 | mod a { 3 | mod b; 4 | } 5 | 6 | mod c { 7 | mod d; 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue-1055.rs: -------------------------------------------------------------------------------- 1 | fn issue_1055() { 2 | let foo = (|| {})(); 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/issue-1111.rs: -------------------------------------------------------------------------------- 1 | use bar; 2 | -------------------------------------------------------------------------------- /tests/target/issue-1158.rs: -------------------------------------------------------------------------------- 1 | trait T { 2 | itemmacro!(this, is.now().formatted(yay)); 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/issue-1177.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-normalize_comments: true 2 | fn main() { 3 | // Line Comment 4 | // Block Comment 5 | 6 | let d = 5; 7 | } 8 | -------------------------------------------------------------------------------- /tests/target/issue-1192.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | assert!(true); 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/issue-1210/c.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_strings: true 2 | // rustfmt-max_width: 50 3 | 4 | const foo: String = 5 | "trailing_spaces!! 6 | keep them! Amet neque. Praesent \ 7 | rhoncus eros non velit."; 8 | -------------------------------------------------------------------------------- /tests/target/issue-1210/d.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-wrap_comments: true 2 | 3 | // trailing_spaces_in_comment!! 4 | // remove those from above 5 | -------------------------------------------------------------------------------- /tests/target/issue-1214.rs: -------------------------------------------------------------------------------- 1 | /*! 2 | # Example 3 | 4 | ``` 5 | // Here goes some example 6 | ``` 7 | */ 8 | struct Item; 9 | -------------------------------------------------------------------------------- /tests/target/issue-1216.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-normalize_comments: true 2 | enum E { 3 | A, //* I am not a block comment (caused panic) 4 | B, 5 | } 6 | -------------------------------------------------------------------------------- /tests/target/issue-1247.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-max_width: 80 2 | 3 | fn foo() { 4 | polyfill::slice::fill( 5 | &mut self.pending[padding_pos..(self.algorithm.block_len - 8)], 6 | 0, 7 | ); 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue-1278.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style = "block" 2 | 3 | #![feature(pub_restricted)] 4 | 5 | mod inner_mode { 6 | pub(super) fn func_name(abc: i32) -> i32 { 7 | abc 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tests/target/issue-1598.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | //foo 3 | /* 4 | */ 5 | format!("hello"); 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/issue-1624.rs: -------------------------------------------------------------------------------- 1 | // #1624 2 | pub unsafe fn some_long_function_name( 3 | arg1: Type1, 4 | arg2: Type2, 5 | ) -> (SomeLongTypeName, AnotherLongTypeName, AnotherLongTypeName) { 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/issue-1693.rs: -------------------------------------------------------------------------------- 1 | fn issue1693() { 2 | let pixel_data = vec![ 3 | ( 4 | f16::from_f32(0.82), 5 | f16::from_f32(1.78), 6 | f16::from_f32(0.21) 7 | ); 8 | 256 * 256 9 | ]; 10 | } 11 | -------------------------------------------------------------------------------- /tests/target/issue-1703.rs: -------------------------------------------------------------------------------- 1 | // rustfmt should not remove doc comments or comments inside attributes. 2 | 3 | /** 4 | This function has a block doc comment. 5 | */ 6 | fn test_function() {} 7 | 8 | #[foo /* do not remove this! */] 9 | fn foo() {} 10 | -------------------------------------------------------------------------------- /tests/target/issue-1800.rs: -------------------------------------------------------------------------------- 1 | #![doc(html_root_url = "http://example.com")] 2 | #[cfg(feature = "foo")] 3 | fn a() {} 4 | -------------------------------------------------------------------------------- /tests/target/issue-1802.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-tab_spaces: 2 2 | // rustfmt-max_width: 30 3 | 4 | enum F { 5 | X { 6 | a: dddddddddddddd, 7 | b: eeeeeeeeeeeeeee, 8 | }, 9 | } 10 | -------------------------------------------------------------------------------- /tests/target/issue-1824.rs: -------------------------------------------------------------------------------- 1 | pub trait Ingredient 2 | where 3 | Self: Send, 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /tests/target/issue-1914.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-max_width: 80 2 | 3 | extern "C" { 4 | #[link_name = "_ZN7MyClass26example_check_no_collisionE"] 5 | pub static mut MyClass_example_check_no_collision: 6 | *const ::std::os::raw::c_int; 7 | } 8 | -------------------------------------------------------------------------------- /tests/target/issue-2025.rs: -------------------------------------------------------------------------------- 1 | // See if rustfmt removes empty lines on top of the file. 2 | pub fn foo() { 3 | println!("hello, world"); 4 | } 5 | -------------------------------------------------------------------------------- /tests/target/issue-2103.rs: -------------------------------------------------------------------------------- 1 | struct X 2 | where 3 | i32: Sized, 4 | { 5 | x: i32, 6 | } 7 | 8 | struct X 9 | // with comment 10 | where 11 | i32: Sized, 12 | { 13 | x: i32, 14 | } 15 | -------------------------------------------------------------------------------- /tests/target/issue-2123.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-wrap_comments: true 2 | 3 | //hello 4 | //world 5 | 6 | fn main() {} 7 | -------------------------------------------------------------------------------- /tests/target/issue-2256.rs: -------------------------------------------------------------------------------- 1 | // こんにちは 2 | use std::borrow::Cow; 3 | 4 | /* comment 1 */ 5 | /* comment 2 */ 6 | 7 | /* comment 3 */ 8 | -------------------------------------------------------------------------------- /tests/target/issue-2342.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-max_width: 80 2 | 3 | struct Foo { 4 | #[cfg(feature = "serde")] 5 | bytes: [[u8; 17]; 5], // Same size as signature::ED25519_PKCS8_V2_LEN 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/issue-2346.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-normalize_comments: true 2 | // the following empty comment should not have any trailing space added. 3 | // 4 | fn main() {} 5 | -------------------------------------------------------------------------------- /tests/target/issue-2401.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-hard_tabs = true 2 | // rustfmt-normalize_comments = true 3 | 4 | /// ``` 5 | /// println!("Hello, World!"); 6 | /// ``` 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /tests/target/issue-2446.rs: -------------------------------------------------------------------------------- 1 | enum Issue2446 { 2 | V { 3 | f: u8, // x 4 | }, 5 | } 6 | 7 | enum Issue2446TrailingCommentsOnly { 8 | V { f: u8 /* */ }, 9 | } 10 | -------------------------------------------------------------------------------- /tests/target/issue-2482/a.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-reorder_modules: true 2 | 3 | // Do not reorder inline modules. 4 | 5 | mod c; 6 | mod a { 7 | fn a() {} 8 | } 9 | mod b; 10 | -------------------------------------------------------------------------------- /tests/target/issue-2482/b.rs: -------------------------------------------------------------------------------- 1 | pub fn b() {} 2 | -------------------------------------------------------------------------------- /tests/target/issue-2482/c.rs: -------------------------------------------------------------------------------- 1 | pub fn c() {} 2 | -------------------------------------------------------------------------------- /tests/target/issue-2534/format_macro_matchers_false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_macro_matchers: false 2 | 3 | macro_rules! foo { 4 | ($a:ident : $b:ty) => {}; 5 | ($a:ident $b:ident $c:ident) => {}; 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/issue-2534/format_macro_matchers_true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_macro_matchers: true 2 | 3 | macro_rules! foo { 4 | ($a:ident : $b:ty) => {}; 5 | ($a:ident $b:ident $c:ident) => {}; 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/issue-2551.rs: -------------------------------------------------------------------------------- 1 | mcro!(func(A { 2 | a: 12345667800111111111111, 3 | })); 4 | -------------------------------------------------------------------------------- /tests/target/issue-2582.rs: -------------------------------------------------------------------------------- 1 | fn main() {} 2 | -------------------------------------------------------------------------------- /tests/target/issue-2641.rs: -------------------------------------------------------------------------------- 1 | macro_rules! a { 2 | () => {{}}; 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/issue-2644.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-max_width: 80 2 | fn foo(e: Enum) { 3 | match e { 4 | Enum::Var { element1, element2 } => { 5 | return; 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue-2673-nonmodrs-mods/foo.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-config: skip_children.toml 2 | mod bar; 3 | 4 | mod baz {} 5 | -------------------------------------------------------------------------------- /tests/target/issue-2673-nonmodrs-mods/foo/bar.rs: -------------------------------------------------------------------------------- 1 | fn dummy() {} 2 | -------------------------------------------------------------------------------- /tests/target/issue-2673-nonmodrs-mods/lib.rs: -------------------------------------------------------------------------------- 1 | #![feature(non_modrs_mods)] 2 | 3 | // Test that submodules in non-mod.rs files work. This is just an idempotence 4 | // test since we just want to verify that rustfmt doesn't fail. 5 | 6 | mod foo; 7 | -------------------------------------------------------------------------------- /tests/target/issue-2728.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-wrap_comments: true 2 | // rustfmt-newline_style: Windows 3 | 4 | //! ```rust 5 | //! extern crate uom; 6 | //! ``` 7 | 8 | fn main() {} 9 | -------------------------------------------------------------------------------- /tests/target/issue-2794.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style: Block 2 | // rustfmt-imports_indent: Block 3 | // rustfmt-imports_layout: Vertical 4 | 5 | use std::{ 6 | env, 7 | fs, 8 | io::{ 9 | Read, 10 | Write, 11 | }, 12 | }; 13 | -------------------------------------------------------------------------------- /tests/target/issue-2835.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-brace_style: AlwaysNextLine 2 | // rustfmt-fn_single_line: true 3 | 4 | fn lorem() -> i32 { 42 } 5 | -------------------------------------------------------------------------------- /tests/target/issue-2916.rs: -------------------------------------------------------------------------------- 1 | a_macro!(name, 2 | ); 3 | -------------------------------------------------------------------------------- /tests/target/issue-2917/minimal.rs: -------------------------------------------------------------------------------- 1 | macro_rules! foo { 2 | () => { 3 | // comment 4 | /* 5 | 6 | */ 7 | }; 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue-2927-2.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-edition: 2015 2 | #![feature(uniform_paths)] 3 | use futures::prelude::*; 4 | use http_03::cli::Cli; 5 | use hyper::{service::service_fn_ok, Body, Response, Server}; 6 | use log::{error, info, log}; 7 | use structopt::StructOpt; 8 | -------------------------------------------------------------------------------- /tests/target/issue-2927.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-edition: 2018 2 | #![feature(uniform_paths)] 3 | use ::log::{error, info, log}; 4 | use futures::prelude::*; 5 | use http_03::cli::Cli; 6 | use hyper::{service::service_fn_ok, Body, Response, Server}; 7 | use structopt::StructOpt; 8 | -------------------------------------------------------------------------------- /tests/target/issue-2930.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style: Visual 2 | fn main() { 3 | let (first_variable, second_variable) = (this_is_something_with_an_extraordinarily_long_name, 4 | this_variable_name_is_also_pretty_long); 5 | } 6 | -------------------------------------------------------------------------------- /tests/target/issue-2941.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-wrap_comments: true 2 | 3 | //! ``` 4 | //! \ 5 | //! ``` 6 | -------------------------------------------------------------------------------- /tests/target/issue-2955.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-condense_wildcard_suffixes: true 2 | fn main() { 3 | match (1, 2, 3) { 4 | (..) => (), 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/issue-2976.rs: -------------------------------------------------------------------------------- 1 | fn a(_ /*comment*/: u8 /* toto */) {} 2 | fn b(/*comment*/ _: u8 /* tata */) {} 3 | fn c(_: /*comment*/ u8) {} 4 | -------------------------------------------------------------------------------- /tests/target/issue-2995.rs: -------------------------------------------------------------------------------- 1 | fn issue_2995() { 2 | // '\u{2028}' is inserted in the code below. 3 | 4 | [0, 1]; 5 | [0, /* */ 1]; 6 | [0, 1]; 7 | } 8 | -------------------------------------------------------------------------------- /tests/target/issue-3043.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-edition: 2018 2 | 3 | use ::std::vec::Vec; 4 | 5 | fn main() {} 6 | -------------------------------------------------------------------------------- /tests/target/issue-3055/backtick.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-wrap_comments: true 2 | 3 | /// Simple block 4 | /// 5 | /// ```text 6 | /// ` 7 | /// ``` 8 | fn main() { 9 | println!("Hello, world!"); 10 | } 11 | -------------------------------------------------------------------------------- /tests/target/issue-3066.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-indent_style: Visual 2 | fn main() { 3 | Struct { field: aaaaaaaaaaa }; 4 | Struct { field: aaaaaaaaaaaa }; 5 | Struct { field: value, 6 | field2: value2 }; 7 | } 8 | -------------------------------------------------------------------------------- /tests/target/issue-3118.rs: -------------------------------------------------------------------------------- 1 | use { 2 | crate::foo::bar, 3 | bytes::{Buf, BufMut}, 4 | std::io, 5 | }; 6 | 7 | mod foo { 8 | pub mod bar {} 9 | } 10 | 11 | fn main() {} 12 | -------------------------------------------------------------------------------- /tests/target/issue-3124.rs: -------------------------------------------------------------------------------- 1 | pub fn fail1() { 2 | // Some comment. 3 | /**/// 4 | } 5 | 6 | pub fn fail2() { 7 | // Some comment. 8 | /**/ 9 | } 10 | 11 | pub fn fail3() { 12 | // Some comment. 13 | // 14 | } 15 | -------------------------------------------------------------------------------- /tests/target/issue-3131.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | match 3 { 3 | t if match t { 4 | _ => true, 5 | } => {} 6 | _ => {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue-3132.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2024 2 | 3 | fn test() { 4 | /* 5 | a 6 | */ 7 | let x = 42; 8 | /* 9 | aaa 10 | "line 1 11 | line 2 12 | line 3" 13 | */ 14 | let x = 42; 15 | } 16 | -------------------------------------------------------------------------------- /tests/target/issue-3184.rs: -------------------------------------------------------------------------------- 1 | /*/ 2 | struct Error{ 3 | message: String, 4 | } 5 | */ 6 | -------------------------------------------------------------------------------- /tests/target/issue-3241.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-edition: 2018 2 | 3 | use ::baz::{bar, foo}; 4 | use ::ignore; 5 | use ::ignore::some::more; 6 | use ::*; 7 | use ::{bar, foo}; 8 | 9 | fn main() { 10 | println!("Hello, world!"); 11 | } 12 | -------------------------------------------------------------------------------- /tests/target/issue-3253/bar.rs: -------------------------------------------------------------------------------- 1 | // Empty 2 | fn empty() {} 3 | -------------------------------------------------------------------------------- /tests/target/issue-3253/foo.rs: -------------------------------------------------------------------------------- 1 | pub fn hello() { 2 | println!("Hello World!"); 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/issue-3253/paths/bar_foo.rs: -------------------------------------------------------------------------------- 1 | fn foo_decl_item(x: &mut i32) { 2 | x = 3; 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/issue-3253/paths/foo_bar.rs: -------------------------------------------------------------------------------- 1 | fn Foo() 2 | where 3 | T: Bar, 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /tests/target/issue-3270/one.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2015 2 | 3 | pub fn main() { 4 | /* let s = String::from( 5 | " 6 | hello 7 | world 8 | ", 9 | ); */ 10 | 11 | assert_eq!(s, "\nhello\nworld\n"); 12 | } 13 | -------------------------------------------------------------------------------- /tests/target/issue-3270/two.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2024 2 | 3 | pub fn main() { 4 | /* let s = String::from( 5 | " 6 | hello 7 | world 8 | ", 9 | ); */ 10 | 11 | assert_eq!(s, "\nhello\nworld\n"); 12 | } 13 | -------------------------------------------------------------------------------- /tests/target/issue-3278/style_edition_2015.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2015 2 | 3 | pub fn parse_conditional<'a, I: 'a>( 4 | ) -> impl Parser + 'a 5 | where 6 | I: Stream, 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue-3278/style_edition_2024.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2024 2 | 3 | pub fn parse_conditional<'a, I: 'a>( 4 | ) -> impl Parser + 'a 5 | where 6 | I: Stream, 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue-3278/style_edition_2027.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2027 2 | 3 | pub fn parse_conditional<'a, I: 'a>() 4 | -> impl Parser + 'a 5 | where 6 | I: Stream, 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue-3314.rs: -------------------------------------------------------------------------------- 1 | /*code 2 | /*code*/ 3 | if true { 4 | println!("1"); 5 | }*/ 6 | -------------------------------------------------------------------------------- /tests/target/issue-3423.rs: -------------------------------------------------------------------------------- 1 | /* a nice comment with a trailing whitespace */ 2 | fn foo() {} 3 | 4 | /* a nice comment with a trailing tab */ 5 | fn bar() {} 6 | -------------------------------------------------------------------------------- /tests/target/issue-3434/not_skip_macro.rs: -------------------------------------------------------------------------------- 1 | #[this::is::not::skip::macros(ouch)] 2 | 3 | fn main() { 4 | let macro_result1 = ouch! {
5 | this should be mangled
6 | } 7 | .to_string(); 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue-3499.rs: -------------------------------------------------------------------------------- 1 | test![]; 2 | -------------------------------------------------------------------------------- /tests/target/issue-3515.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-reorder_imports: false 2 | 3 | use std::fmt::{self, Display}; 4 | use std::collections::HashMap; 5 | 6 | fn main() {} 7 | -------------------------------------------------------------------------------- /tests/target/issue-3532.rs: -------------------------------------------------------------------------------- 1 | fn foo(a: T) { 2 | match a { 3 | 1 => {} 4 | 0 => {} // _ => panic!("doesn't format!"), 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/issue-3539.rs: -------------------------------------------------------------------------------- 1 | use std::io::Error; 2 | 3 | fn main() { 4 | let _read_num: fn() -> Result<(i32), Error> = || -> Result<(i32), Error> { 5 | let a = 1; 6 | Ok(a) 7 | }; 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue-3554.rs: -------------------------------------------------------------------------------- 1 | #![feature(const_generics)] 2 | 3 | pub struct S; 4 | impl S<{ 0 }> {} 5 | -------------------------------------------------------------------------------- /tests/target/issue-3567.rs: -------------------------------------------------------------------------------- 1 | fn check() { 2 | vec![vec!(0; 10); 10]; 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/issue-3568.rs: -------------------------------------------------------------------------------- 1 | use a::b::{self}; 2 | -------------------------------------------------------------------------------- /tests/target/issue-3585/reorder_imports_disabled.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-inline_attribute_width: 100 2 | // rustfmt-reorder_imports: false 3 | 4 | #[cfg(unix)] extern crate crateb; 5 | #[cfg(unix)] extern crate cratea; 6 | 7 | #[cfg(unix)] use crateb; 8 | #[cfg(unix)] use cratea; 9 | -------------------------------------------------------------------------------- /tests/target/issue-3585/reorder_imports_enabled.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-inline_attribute_width: 100 2 | // rustfmt-reorder_imports: true 3 | 4 | #[cfg(unix)] extern crate cratea; 5 | #[cfg(unix)] extern crate crateb; 6 | 7 | #[cfg(unix)] use cratea; 8 | #[cfg(unix)] use crateb; 9 | -------------------------------------------------------------------------------- /tests/target/issue-3585/use.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-inline_attribute_width: 100 2 | 3 | #[macro_use] use static_assertions; 4 | 5 | #[cfg(unix)] use static_assertions; 6 | -------------------------------------------------------------------------------- /tests/target/issue-3595.rs: -------------------------------------------------------------------------------- 1 | struct ReqMsg(); 2 | struct RespMsg(); 3 | 4 | pub type TestType = fn() -> (ReqMsg, fn(RespMsg) -> ()); 5 | -------------------------------------------------------------------------------- /tests/target/issue-3601.rs: -------------------------------------------------------------------------------- 1 | #![feature(const_generics)] 2 | 3 | trait A { 4 | fn foo(&self); 5 | } 6 | 7 | pub struct B([usize; N]); 8 | 9 | impl A for B<{ N }> { 10 | fn foo(&self) {} 11 | } 12 | -------------------------------------------------------------------------------- /tests/target/issue-3614/version_one.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2015 2 | 3 | fn main() { 4 | let toto = || { 5 | if true { 6 | 42 7 | } else { 8 | 24 9 | } 10 | }; 11 | 12 | { 13 | T 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /tests/target/issue-3614/version_two.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2024 2 | 3 | fn main() { 4 | let toto = || { 5 | if true { 42 } else { 24 } 6 | }; 7 | { T } 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue-3639.rs: -------------------------------------------------------------------------------- 1 | trait Foo {} 2 | struct Bar {} 3 | struct Bax; 4 | struct Baz(String); 5 | impl Foo for Bar {} 6 | -------------------------------------------------------------------------------- /tests/target/issue-3645.rs: -------------------------------------------------------------------------------- 1 | mod x { 2 | use super::self as x; 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/issue-3651.rs: -------------------------------------------------------------------------------- 1 | fn f() -> Box< 2 | dyn FnMut() -> Thing< 3 | WithType = LongItemName, 4 | Error = LONGLONGLONGLONGLONGONGEvenLongerErrorNameLongerLonger, 5 | >, 6 | > { 7 | } 8 | -------------------------------------------------------------------------------- /tests/target/issue-3665/not_skip_attribute.rs: -------------------------------------------------------------------------------- 1 | #![this::is::not::skip::attribute(ouch)] 2 | 3 | #[ouch(not, skip, me)] 4 | fn main() {} 5 | -------------------------------------------------------------------------------- /tests/target/issue-3672.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | let x = 5; 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/issue-3675.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | println!( 3 | "{}", // comment 4 | 111 5 | ); 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/issue-3709.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-edition: 2018 2 | 3 | macro_rules! token { 4 | ($t:tt) => {}; 5 | } 6 | 7 | fn main() { 8 | token!(dyn); 9 | token!(dyn); 10 | } 11 | -------------------------------------------------------------------------------- /tests/target/issue-3711.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | println!( 3 | "{}", // comment 4 | 111 5 | ); 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/issue-3717.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | { 3 | #[rustfmt::skip] 4 | let _ = 5 | [1]; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/target/issue-3718.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | let x: &[i32] = &[2, 2]; 3 | match x { 4 | [_a, _] => println!("Wrong username or password"), 5 | _ => println!("Logged in"), 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/target/issue-3750.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-imports_granularity: Crate 2 | 3 | pub mod foo { 4 | pub mod bar { 5 | pub struct Bar; 6 | } 7 | 8 | pub fn bar() {} 9 | } 10 | 11 | use foo::{bar, bar::Bar}; 12 | 13 | fn main() { 14 | bar(); 15 | } 16 | -------------------------------------------------------------------------------- /tests/target/issue-3751.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_code_in_doc_comments: true 2 | 3 | //! Empty pound line 4 | //! 5 | //! ```rust 6 | //! # 7 | //! # fn main() { 8 | //! foo(); 9 | //! # } 10 | //! ``` 11 | -------------------------------------------------------------------------------- /tests/target/issue-3779/ice.rs: -------------------------------------------------------------------------------- 1 | pub fn bar() { 2 | 1x; 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/issue-3779/lib.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-unstable: true 2 | // rustfmt-config: issue-3779.toml 3 | 4 | #[path = "ice.rs"] 5 | mod ice; 6 | 7 | fn foo() { 8 | println!("abc"); 9 | } 10 | -------------------------------------------------------------------------------- /tests/target/issue-3815.rs: -------------------------------------------------------------------------------- 1 | pub type Type = impl Deref; 2 | 3 | pub type Type = 4 | impl VeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeryLongType; 5 | -------------------------------------------------------------------------------- /tests/target/issue-3845.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | || { 3 | #[allow(deprecated)] 4 | { 5 | u8::max_value() 6 | } 7 | }; 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue-3882.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2024 2 | fn bar(_t: T, // bar 3 | ) { 4 | } 5 | -------------------------------------------------------------------------------- /tests/target/issue-4018.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | /* extra comment */ 3 | } 4 | 5 | fn main() { 6 | println!(""); 7 | // comment 1 8 | // comment 2 9 | // comment 3 10 | // comment 4 11 | } 12 | -------------------------------------------------------------------------------- /tests/target/issue-4020.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-wrap_comments: true 2 | 3 | /** foobar */ 4 | const foo1: u32 = 0; 5 | 6 | /** 7 | * foobar 8 | */ 9 | const foo2: u32 = 0; 10 | -------------------------------------------------------------------------------- /tests/target/issue-4029.rs: -------------------------------------------------------------------------------- 1 | // issue #4029 2 | #[derive(Debug, Clone, Default Hash)] 3 | struct S; 4 | 5 | // issue #3898 6 | #[derive(Debug, Clone, Default,, Hash)] 7 | struct T; 8 | -------------------------------------------------------------------------------- /tests/target/issue-4068.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | extern "C" fn packet_records_options_impl_layout_length_encoding_option_len_multiplier(); 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/issue-4115.rs: -------------------------------------------------------------------------------- 1 | #[derive( 2 | A, 3 | B, 4 | C, 5 | D, 6 | // E, 7 | )] 8 | fn foo() {} 9 | -------------------------------------------------------------------------------- /tests/target/issue-4310.rs: -------------------------------------------------------------------------------- 1 | #![feature(const_generics)] 2 | 3 | fn foo< 4 | const N: [u8; { 5 | struct Inner<'a>(&'a ()); 6 | 3 7 | }], 8 | >() { 9 | } 10 | -------------------------------------------------------------------------------- /tests/target/issue-4313.rs: -------------------------------------------------------------------------------- 1 | extern "C" { 2 | fn f() { 3 | fn g() {} 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/target/issue-4381/style_edition_2015.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2015 2 | 3 | use std::num::{NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8}; 4 | -------------------------------------------------------------------------------- /tests/target/issue-4381/style_edition_2024.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2024 2 | 3 | use std::num::{NonZeroU8, NonZeroU16, NonZeroU32, NonZeroU64}; 4 | -------------------------------------------------------------------------------- /tests/target/issue-4382.rs: -------------------------------------------------------------------------------- 1 | pub const NAME_MAX: usize = { 2 | #[cfg(target_os = "linux")] 3 | { 4 | 1024 5 | } 6 | #[cfg(target_os = "freebsd")] 7 | { 8 | 255 9 | } 10 | }; 11 | -------------------------------------------------------------------------------- /tests/target/issue-4615/minimum_example.rs: -------------------------------------------------------------------------------- 1 | info!( 2 | //debug 3 | "{}: sending function_code={:04x} data={:04x} crc=0x{:04X} data={:02X?}", 4 | self.name, function_code, data, crc, output_cmd 5 | ); 6 | -------------------------------------------------------------------------------- /tests/target/issue-4656/format_me_please.rs: -------------------------------------------------------------------------------- 1 | pub fn hello() {} 2 | -------------------------------------------------------------------------------- /tests/target/issue-4656/lib.rs: -------------------------------------------------------------------------------- 1 | extern crate cfg_if; 2 | 3 | cfg_if::cfg_if! { 4 | if #[cfg(target_family = "unix")] { 5 | mod format_me_please; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/target/issue-4656/lib2.rs: -------------------------------------------------------------------------------- 1 | its_a_macro! { 2 | // Contents 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/issue-4791/buggy.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-struct_field_align_threshold: 30 2 | // rustfmt-trailing_comma: Never 3 | 4 | struct Foo { 5 | group_a: u8, 6 | 7 | group_b: u8 8 | } 9 | 10 | struct Bar { 11 | group_a: u8, 12 | 13 | group_b: u8 14 | } 15 | -------------------------------------------------------------------------------- /tests/target/issue-4791/no_trailing_comma.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-struct_field_align_threshold: 0 2 | // rustfmt-trailing_comma: Never 3 | 4 | pub struct Baz { 5 | group_a: u8, 6 | 7 | group_b: u8 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue-4808.rs: -------------------------------------------------------------------------------- 1 | trait Trait { 2 | fn method(&self) {} 3 | } 4 | 5 | impl T, T> Trait for F {} 6 | 7 | impl Trait for f32 {} 8 | 9 | fn main() { 10 | || (10.).method(); 11 | (|| ..).method(); 12 | (|| 1..).method(); 13 | } 14 | -------------------------------------------------------------------------------- /tests/target/issue-4926/minimum_example.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-struct_field_align_threshold: 30 2 | 3 | struct X { 4 | a: i32, 5 | b: i32, 6 | } 7 | 8 | fn test(x: X) { 9 | let y = matches!(x, X { a: 1, .. }); 10 | } 11 | -------------------------------------------------------------------------------- /tests/target/issue-4984/minimum_example.rs: -------------------------------------------------------------------------------- 1 | #[derive(/*Debug, */ Clone)] 2 | struct Foo; 3 | -------------------------------------------------------------------------------- /tests/target/issue-4984/should_not_change.rs: -------------------------------------------------------------------------------- 1 | #[derive(Clone, Debug, Eq, PartialEq)] 2 | struct Foo; 3 | 4 | #[derive(Clone)] 5 | struct Bar; 6 | -------------------------------------------------------------------------------- /tests/target/issue-5009/1_minimum_example.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | // the "in" inside the pattern produced invalid syntax 3 | for variable_in_here /* ... */ in 0..1 {} 4 | } 5 | -------------------------------------------------------------------------------- /tests/target/issue-5009/2_many_in_connectors_in_pattern.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | for in_in_in_in_in_in_in_in /* ... */ in 0..1 {} 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/issue-5009/3_nested_for_loop_with_connector_in_pattern.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | for variable_in_x /* ... */ in 0..1 { 3 | for variable_in_y /* ... */ in 0..1 {} 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tests/target/issue-5011.rs: -------------------------------------------------------------------------------- 1 | pub(crate) struct ASlash( 2 | // hello 3 | i32, 4 | ); 5 | 6 | pub(crate) struct AStar(/* hello */ i32); 7 | 8 | pub(crate) struct BStar(/* hello */ i32); 9 | -------------------------------------------------------------------------------- /tests/target/issue-5012/trailing_comma_always.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-trailing_comma: Always 2 | 3 | pub struct Matrix 4 | where 5 | [T; R * C]:, 6 | { 7 | contents: [T; R * C], 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue-5012/trailing_comma_never.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-trailing_comma: Never 2 | 3 | pub struct Matrix 4 | where 5 | [T; R * C]: 6 | { 7 | contents: [T; R * C] 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue-5033/minimum_example.rs: -------------------------------------------------------------------------------- 1 | // leading comment 2 | 3 | #![rustfmt::skip] 4 | fn main() { 5 | println!("main"); // commented 6 | } 7 | 8 | // post comment 9 | -------------------------------------------------------------------------------- /tests/target/issue-5033/nested_modules.rs: -------------------------------------------------------------------------------- 1 | #![rustfmt::skip] 2 | 3 | mod a { 4 | mod b { 5 | 6 | } 7 | 8 | // trailing comment b 9 | } 10 | 11 | // trailing comment a 12 | -------------------------------------------------------------------------------- /tests/target/issue-5042/single-line_comment_with_trailing_comma.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | let _ = std::ops::Add::add( 3 | 10, 20, // ..., 4 | ); 5 | 6 | let _ = std::ops::Add::add(10, 20 /* ... */); 7 | } 8 | -------------------------------------------------------------------------------- /tests/target/issue-5042/single-line_comment_without_trailing_comma.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | let _ = std::ops::Add::add( 3 | 10, 20, // ... 4 | ); 5 | 6 | let _ = std::ops::Add::add(10, 20 /* ... */); 7 | } 8 | -------------------------------------------------------------------------------- /tests/target/issue-5066/with_trailing_comma_always.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-trailing_comma: Always 2 | 3 | fn main() { 4 | let Foo { a, .. } = b; 5 | } 6 | -------------------------------------------------------------------------------- /tests/target/issue-5066/with_trailing_comma_never.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-trailing_comma: Never 2 | 3 | fn main() { 4 | let Foo { a, .. } = b; 5 | } 6 | -------------------------------------------------------------------------------- /tests/target/issue-5088/single_line_itemized_block_wrap_comments_false.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-wrap_comments: false 2 | 3 | // - some itemized block 1 4 | 5 | // * some itemized block 2 6 | 7 | /* - some itemized block 3 */ 8 | 9 | /* * some itemized block 4 */ 10 | -------------------------------------------------------------------------------- /tests/target/issue-5088/single_line_itemized_block_wrap_comments_true.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-wrap_comments: true 2 | 3 | // - some itemized block 1 4 | 5 | // * some itemized block 2 6 | 7 | /* - some itemized block 3 */ 8 | 9 | /* * some itemized block 4 */ 10 | -------------------------------------------------------------------------------- /tests/target/issue-5125/attributes_in_formal_fuction_parameter.rs: -------------------------------------------------------------------------------- 1 | fn foo( 2 | #[unused] a: >::ForeignType, 5 | ) { 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/issue-5125/minimum_example.rs: -------------------------------------------------------------------------------- 1 | fn foo( 2 | a: >::ForeignType, 5 | ) { 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/issue-5125/with_leading_and_inline_comments.rs: -------------------------------------------------------------------------------- 1 | fn foo( 2 | // Pre Comment 3 | a: >::ForeignType, // Inline comment 6 | ) { 7 | } 8 | -------------------------------------------------------------------------------- /tests/target/issue-5244/unwrapped.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-wrap_comments: false 2 | 3 | /// Here is me writing some documentation that is too long oh me oh my now some code please! 4 | /// ``` 5 | /// test 6 | /// ``` 7 | fn foo() {} 8 | -------------------------------------------------------------------------------- /tests/target/issue-5244/wrapped.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-wrap_comments: true 2 | 3 | /// Here is me writing some documentation that is too long oh me oh my now some 4 | /// code please! 5 | /// ``` 6 | /// test 7 | /// ``` 8 | fn foo() {} 9 | -------------------------------------------------------------------------------- /tests/target/issue-5358.rs: -------------------------------------------------------------------------------- 1 | // Test /* comment */ inside trait generics does not get duplicated. 2 | trait Test {} 3 | 4 | trait TestTwo {} 5 | -------------------------------------------------------------------------------- /tests/target/issue-539.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-normalize_comments: true 2 | // FIXME (#3300): Should allow items to be anonymous. Right now 3 | // we just use dummy names for anon items. 4 | -------------------------------------------------------------------------------- /tests/target/issue-5655/one.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2015 2 | 3 | fn foo(_: T) 4 | where 5 | T: std::fmt::Debug, 6 | 7 | T: std::fmt::Display, 8 | { 9 | } 10 | -------------------------------------------------------------------------------- /tests/target/issue-5655/two.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2024 2 | 3 | fn foo(_: T) 4 | where 5 | T: std::fmt::Debug, 6 | T: std::fmt::Display, 7 | { 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue-5791.rs: -------------------------------------------------------------------------------- 1 | pub fn main() { 2 | (0.).to_string(); 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/issue-5797/retain_trailing_semicolon.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-trailing_semicolon: false 2 | 3 | fn foo() {} 4 | fn main() { 5 | return; 6 | foo() 7 | } 8 | -------------------------------------------------------------------------------- /tests/target/issue-5835.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-wrap_comments: true 2 | 3 | /// . a 4 | pub fn foo() {} 5 | 6 | pub fn main() { 7 | // . a 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue-5852/issue_example.rs: -------------------------------------------------------------------------------- 1 | use std::{ 2 | fs, 3 | // (temporarily commented, we'll need this again in a second) io, 4 | }; 5 | 6 | use foo::{ 7 | self, // this is important 8 | }; 9 | -------------------------------------------------------------------------------- /tests/target/issue-5871.rs: -------------------------------------------------------------------------------- 1 | #![feature(stmt_expr_attributes)] 2 | fn okay() -> u32 { 3 | ( 4 | // Comments in parentheses-expressions caused attributes to be duplicated. 5 | #[allow(unused_variables)] 6 | 0 7 | ) 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue-5885.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | println!("{}", builtin # offset_of(A, 0. 1.1.1)); 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/issue-5935.rs: -------------------------------------------------------------------------------- 1 | struct Regs< 2 | const BEGIN: u64, 3 | const END: u64, 4 | const DIM: usize, 5 | const N: usize = { (END - BEGIN) as usize / (8 * DIM) + 1 }, 6 | > { 7 | _foo: u64, 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue-6059/additional.rs: -------------------------------------------------------------------------------- 1 | fn float_range_tests() { 2 | let _range = 3. / 2. ..4.; 3 | let _range = 3.0 / 2. ..4.0; 4 | let _range = 3.0 / 2.0..4.0; 5 | let _range = 3. / 2.0..4.0; 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/issue-6059/repro.rs: -------------------------------------------------------------------------------- 1 | fn float_range_tests() { 2 | self.coords.x -= rng.gen_range(-self.radius / 2. ..self.radius / 2.); 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/issue-6105.rs: -------------------------------------------------------------------------------- 1 | const _: () = builtin # offset_of(x, x); 2 | -------------------------------------------------------------------------------- /tests/target/issue-6109.rs: -------------------------------------------------------------------------------- 1 | /// Some doc comment with code snippet: 2 | ///``` 3 | /// '\u{1F} 4 | /// ``` 5 | pub struct Code {} 6 | 7 | fn main() {} 8 | -------------------------------------------------------------------------------- /tests/target/issue-64.rs: -------------------------------------------------------------------------------- 1 | // Regression test for issue 64 2 | 3 | pub fn header_name() -> &'static str { 4 | let name = ::header_name(); 5 | let func = ::header_name; 6 | name 7 | } 8 | -------------------------------------------------------------------------------- /tests/target/issue-683.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-normalize_comments: true 2 | // FIXME (#3300): Should allow items to be anonymous. Right now 3 | // we just use dummy names for anon items. 4 | -------------------------------------------------------------------------------- /tests/target/issue-770.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | if false { 3 | if false { 4 | } else { 5 | // A let binding here seems necessary to trigger it. 6 | let _ = (); 7 | } 8 | } else if let false = false { 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /tests/target/issue-831.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | let y = a.iter().any(|x| { 3 | println!("a"); 4 | }) || b.iter().any(|x| { 5 | println!("b"); 6 | }) || c.iter().any(|x| { 7 | println!("c"); 8 | }); 9 | } 10 | -------------------------------------------------------------------------------- /tests/target/issue-850.rs: -------------------------------------------------------------------------------- 1 | const unsafe fn x() {} 2 | -------------------------------------------------------------------------------- /tests/target/issue-977.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-normalize_comments: true 2 | 3 | trait NameC { 4 | // comment 5 | } 6 | struct FooC { 7 | // comment 8 | } 9 | enum MooC { 10 | // comment 11 | } 12 | mod BarC { // comment 13 | } 14 | extern "C" { 15 | // comment 16 | } 17 | -------------------------------------------------------------------------------- /tests/target/issue_3033.rs: -------------------------------------------------------------------------------- 1 | use dom::bindings::codegen::Bindings::BluetoothRemoteGATTServerBinding::BluetoothRemoteGATTServerBinding:: 2 | BluetoothRemoteGATTServerMethods; 3 | -------------------------------------------------------------------------------- /tests/target/issue_3245.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | let x = 1; 3 | let y = 3; 4 | } 5 | -------------------------------------------------------------------------------- /tests/target/issue_3561.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | 7 3 | } 4 | 5 | fn main() { 6 | 7 7 | } 8 | -------------------------------------------------------------------------------- /tests/target/issue_3839.rs: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | a: i32, 3 | /* 4 | asd 5 | */ 6 | // foo 7 | b: i32, 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue_3844.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | || {}; 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/issue_3854.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | println!("{:?}", -1. ..1.); 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/issue_3868.rs: -------------------------------------------------------------------------------- 1 | fn foo() {} 2 | 3 | fn bar() { 4 | for _ in 0..1 {} 5 | } 6 | 7 | fn baz() { 8 | (); 9 | } 10 | -------------------------------------------------------------------------------- /tests/target/issue_3934.rs: -------------------------------------------------------------------------------- 1 | mod repro { 2 | pub fn push() -> Result<(), ()> { 3 | self.api.map_api_result(|api| { 4 | #[allow(deprecated)] 5 | match api.apply_extrinsic_before_version_4_with_context()? {} 6 | }) 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue_3937.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_code_in_doc_comments:true 2 | 3 | struct Foo { 4 | // a: i32, 5 | // 6 | // b: i32, 7 | } 8 | 9 | struct Foo { 10 | a: i32, 11 | // 12 | // b: i32, 13 | } 14 | -------------------------------------------------------------------------------- /tests/target/issue_4086.rs: -------------------------------------------------------------------------------- 1 | #[cfg(any())] 2 | extern "C++" {} 3 | -------------------------------------------------------------------------------- /tests/target/issue_4322.rs: -------------------------------------------------------------------------------- 1 | trait Bar { 2 | type X<'a> 3 | where 4 | Self: 'a; 5 | } 6 | -------------------------------------------------------------------------------- /tests/target/issue_4374.rs: -------------------------------------------------------------------------------- 1 | fn a(_f: F) -> () 2 | where 3 | F: FnOnce() -> (), 4 | { 5 | } 6 | fn main() { 7 | a(|| { 8 | #[allow(irrefutable_let_patterns)] 9 | while let _ = 0 { 10 | break; 11 | } 12 | }); 13 | } 14 | -------------------------------------------------------------------------------- /tests/target/issue_4467.rs: -------------------------------------------------------------------------------- 1 | pub fn main() { 2 | #[cfg(feature = "std")] 3 | { 4 | // Comment 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/issue_4522.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | #[cfg(feature = "foo")] 3 | { 4 | // let foo = 0; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/issue_4528.rs: -------------------------------------------------------------------------------- 1 | #![allow(clippy::no_effect)] 2 | 3 | extern "C" { 4 | // N.B., mutability can be easily incorrect in FFI calls -- as 5 | // in C, the default is mutable pointers. 6 | fn ffi(c: *mut u8); 7 | fn int_ffi(c: *mut i32); 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue_4545.rs: -------------------------------------------------------------------------------- 1 | #[derive(Debug, Foo)] 2 | enum Bar {} 3 | 4 | #[derive(Debug, , Default)] 5 | struct Struct(i32); 6 | -------------------------------------------------------------------------------- /tests/target/issue_4675.rs: -------------------------------------------------------------------------------- 1 | macro_rules! foo { 2 | ($s:ident ( $p:pat )) => { 3 | Foo { 4 | name: Name::$s($p), 5 | .. 6 | } 7 | }; 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue_4823.rs: -------------------------------------------------------------------------------- 1 | macro_rules! m { 2 | () => { 3 | type Type; 4 | }; 5 | } 6 | -------------------------------------------------------------------------------- /tests/target/issue_4850.rs: -------------------------------------------------------------------------------- 1 | impl ThisIsALongStructNameToPushTheWhereToWrapLolololol where 2 | [(); this_is_a_long_const_function_name()]: 3 | { 4 | } 5 | -------------------------------------------------------------------------------- /tests/target/issue_4911.rs: -------------------------------------------------------------------------------- 1 | #![feature(min_type_alias_impl_trait)] 2 | 3 | impl SomeTrait for SomeType { 4 | type SomeGAT<'a> 5 | where 6 | Self: 'a, 7 | = impl SomeOtherTrait; 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue_4936.rs: -------------------------------------------------------------------------------- 1 | #[discard_params_doc] 2 | trait Trait { 3 | fn foo( 4 | &self, 5 | /// some docs 6 | bar: String, 7 | /// another docs 8 | baz: i32, 9 | ); 10 | } 11 | -------------------------------------------------------------------------------- /tests/target/issue_4943.rs: -------------------------------------------------------------------------------- 1 | impl SomeStruct { 2 | fn process(v: T) -> ::R 3 | where 4 | Self: GAT = T>, 5 | { 6 | SomeStruct::do_something(v) 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue_4954.rs: -------------------------------------------------------------------------------- 1 | trait Foo { 2 | type Arg<'a>; 3 | } 4 | 5 | struct Bar(T) 6 | where 7 | for<'a> T: Foo = ()>; 8 | -------------------------------------------------------------------------------- /tests/target/issue_4963.rs: -------------------------------------------------------------------------------- 1 | mod test { 2 | extern "C" { 3 | fn test(); 4 | } 5 | } 6 | 7 | extern "C" { 8 | fn test(); 9 | } 10 | -------------------------------------------------------------------------------- /tests/target/issue_5086.rs: -------------------------------------------------------------------------------- 1 | #[cfg(any())] 2 | type Type: Bound; 3 | -------------------------------------------------------------------------------- /tests/target/issue_5273.rs: -------------------------------------------------------------------------------- 1 | struct Example { 2 | // 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/issue_5542.rs: -------------------------------------------------------------------------------- 1 | #![feature(dyn_star)] 2 | #![allow(incomplete_features)] 3 | 4 | use core::fmt::Debug; 5 | 6 | fn main() { 7 | let i = 42; 8 | let dyn_i = i as dyn* Debug; 9 | dbg!(dyn_i); 10 | } 11 | -------------------------------------------------------------------------------- /tests/target/issue_5668.rs: -------------------------------------------------------------------------------- 1 | type Foo = impl Send; 2 | struct Struct< 3 | const C: usize = { 4 | let _: Foo = (); 5 | //~^ ERROR: mismatched types 6 | 0 7 | }, 8 | >; 9 | -------------------------------------------------------------------------------- /tests/target/issue_5676.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | match true { 3 | true => 'a: { 4 | break 'a; 5 | } 6 | _ => (), 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/issue_5721.rs: -------------------------------------------------------------------------------- 1 | #![feature(non_lifetime_binders)] 2 | #![allow(incomplete_features)] 3 | 4 | trait Other {} 5 | 6 | trait Trait 7 | where 8 | for U: Other, 9 | { 10 | } 11 | -------------------------------------------------------------------------------- /tests/target/issue_5728.rs: -------------------------------------------------------------------------------- 1 | cfg_if::cfg_if! { 2 | if #[cfg(windows)] { 3 | } else if #(&cpus) { 4 | } else [libc::CTL_HW, libc::HW_NCPU, 0, 0] 5 | } 6 | -------------------------------------------------------------------------------- /tests/target/issue_5729.rs: -------------------------------------------------------------------------------- 1 | cfg_if::cfg_if! { 2 | if { 3 | } else if #(&cpus) { 4 | } else [libc::CTL_HW, libc::HW_NCPU, 0, 0] 5 | } 6 | -------------------------------------------------------------------------------- /tests/target/issue_5730.rs: -------------------------------------------------------------------------------- 1 | macro_rules! statement { 2 | () => {}; 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/issue_5735.rs: -------------------------------------------------------------------------------- 1 | fn find_errors(mut self) { 2 | let errors: Vec = vec![ 3 | #[debug_format = "A({})"] 4 | struct A {} 5 | ]; 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/issue_5882.rs: -------------------------------------------------------------------------------- 1 | macro_rules! foo {} 2 | macro_rules! bar { /*comment*/ } 3 | macro_rules! baz { //comment 4 | } 5 | macro_rules! foobar { 6 | //comment 7 | } 8 | -------------------------------------------------------------------------------- /tests/target/issue_5907.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-format_code_in_doc_comments: true 2 | 3 | // ``` 4 | // [ 5 | // ] 6 | // ``` 7 | -------------------------------------------------------------------------------- /tests/target/issue_6069.rs: -------------------------------------------------------------------------------- 1 | // `Foó` as written here ends with ASCII 6F `'o'` followed by `'\u{0301}'` COMBINING ACUTE ACCENT. 2 | // The compiler normalizes that combination to NFC form, `'\u{00F3}'` LATIN SMALL LETTER O WITH ACUTE. 3 | trait Foó: Bar {} 4 | -------------------------------------------------------------------------------- /tests/target/issue_6082.rs: -------------------------------------------------------------------------------- 1 | macro_rules! test { 2 | ($T:ident, $b:lifetime) => { 3 | Box<$T<$b>> 4 | }; 5 | } 6 | -------------------------------------------------------------------------------- /tests/target/issue_6158.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | const { 3 | #![allow(clippy::assertions_on_constants)] 4 | 5 | assert!(1 < 2); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /tests/target/issue_6159.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | builtin # type_ascribe(10, usize) 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/large-block.rs: -------------------------------------------------------------------------------- 1 | fn issue1351() { 2 | std_fmt_Arguments_new_v1_std_rt_begin_panic_fmt_sdfasfasdfasdf({ 3 | static __STATIC_FMTSTR: &'static [&'static str] = &[]; 4 | }); 5 | } 6 | -------------------------------------------------------------------------------- /tests/target/long-use-statement-issue-3154.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-reorder_imports: false 2 | 3 | pub use self::super::super::super::root::mozilla::detail::StringClassFlags as nsTStringRepr_ClassFlags; 4 | -------------------------------------------------------------------------------- /tests/target/long_field_access.rs: -------------------------------------------------------------------------------- 1 | fn f() { 2 | block_flow.base.stacking_relative_position_of_display_port = 3 | self.base.stacking_relative_position_of_display_port; 4 | } 5 | -------------------------------------------------------------------------------- /tests/target/macro_not_expr.rs: -------------------------------------------------------------------------------- 1 | macro_rules! test { 2 | ($($t:tt)*) => {}; 3 | } 4 | 5 | fn main() { 6 | test!( a : B => c d ); 7 | } 8 | -------------------------------------------------------------------------------- /tests/target/macros/rewrite-const-item.rs: -------------------------------------------------------------------------------- 1 | m!( 2 | const N: usize = 0; 3 | ); 4 | -------------------------------------------------------------------------------- /tests/target/max-line-length-in-chars.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-max_width: 25 2 | 3 | // абвгдеёжзийклмнопрст 4 | fn main() {} 5 | -------------------------------------------------------------------------------- /tests/target/merge_imports_true_compat.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-merge_imports: true 2 | 3 | use a::{b, c}; 4 | -------------------------------------------------------------------------------- /tests/target/mod-2.rs: -------------------------------------------------------------------------------- 1 | // Some nested mods 2 | 3 | #[cfg(test)] 4 | mod nestedmod; 5 | pub mod no_new_line_beginning; 6 | -------------------------------------------------------------------------------- /tests/target/mod_skip_child.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-skip_children: true 2 | mod nested_skipped; 3 | -------------------------------------------------------------------------------- /tests/target/mulit-file.rs: -------------------------------------------------------------------------------- 1 | // Tests that where a single file is referred to in multiple places, we don't 2 | // crash. 3 | 4 | #[cfg(all(foo))] 5 | #[path = "closure.rs"] 6 | pub mod imp; 7 | 8 | #[cfg(all(bar))] 9 | #[path = "closure.rs"] 10 | pub mod imp; 11 | -------------------------------------------------------------------------------- /tests/target/negative-bounds.rs: -------------------------------------------------------------------------------- 1 | fn negative() 2 | where 3 | i32: !Copy, 4 | { 5 | } 6 | -------------------------------------------------------------------------------- /tests/target/nested-if-else.rs: -------------------------------------------------------------------------------- 1 | fn issue1518() { 2 | Some(Object { 3 | field: if a { 4 | a_thing 5 | } else if b { 6 | b_thing 7 | } else { 8 | c_thing 9 | }, 10 | }) 11 | } 12 | -------------------------------------------------------------------------------- /tests/target/nested_skipped/mod.rs: -------------------------------------------------------------------------------- 1 | fn ugly() { 2 | 92; 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/nestedmod/mod.rs: -------------------------------------------------------------------------------- 1 | mod mod2a; 2 | mod mod2b; 3 | 4 | mod mymod1 { 5 | use mod2a::{Bar, Foo}; 6 | mod mod3a; 7 | } 8 | 9 | #[path = "mod2c.rs"] 10 | mod mymod2; 11 | 12 | mod submod2; 13 | -------------------------------------------------------------------------------- /tests/target/nestedmod/mod2a.rs: -------------------------------------------------------------------------------- 1 | // This is an empty file containing only 2 | // comments 3 | 4 | // ................... 5 | -------------------------------------------------------------------------------- /tests/target/nestedmod/mod2b.rs: -------------------------------------------------------------------------------- 1 | #[path = "mod2a.rs"] 2 | mod c; 3 | -------------------------------------------------------------------------------- /tests/target/nestedmod/mod2c.rs: -------------------------------------------------------------------------------- 1 | // A standard mod 2 | 3 | fn a() {} 4 | -------------------------------------------------------------------------------- /tests/target/nestedmod/mymod1/mod3a.rs: -------------------------------------------------------------------------------- 1 | // Another mod 2 | fn a() {} 3 | -------------------------------------------------------------------------------- /tests/target/nestedmod/submod2/a.rs: -------------------------------------------------------------------------------- 1 | // Yet Another mod 2 | // Nested 3 | 4 | use c::a; 5 | 6 | fn foo() {} 7 | -------------------------------------------------------------------------------- /tests/target/nestedmod/submod2/mod.rs: -------------------------------------------------------------------------------- 1 | // Another mod 2 | 3 | mod a; 4 | 5 | use a::a; 6 | -------------------------------------------------------------------------------- /tests/target/no_arg_with_comment.rs: -------------------------------------------------------------------------------- 1 | fn foo(/* comment */) {} 2 | -------------------------------------------------------------------------------- /tests/target/no_new_line_beginning.rs: -------------------------------------------------------------------------------- 1 | fn main() {} 2 | -------------------------------------------------------------------------------- /tests/target/non-lifetime-binders.rs: -------------------------------------------------------------------------------- 1 | fn main() 2 | where 3 | for<'a, T: Sized + 'a, const C: usize> [&'a T; C]: Sized, 4 | { 5 | let x = for || {}; 6 | 7 | let y: dyn for Into; 8 | 9 | let z: for fn(T); 10 | } 11 | -------------------------------------------------------------------------------- /tests/target/normalize_multiline_doc_attribute.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-unstable: true 2 | // rustfmt-normalize_doc_attributes: true 3 | 4 | ///This comment 5 | ///is split 6 | ///on multiple lines 7 | fn foo() {} 8 | 9 | /// B1 10 | /// 11 | /// A1 12 | fn bar() {} 13 | -------------------------------------------------------------------------------- /tests/target/obsolete_in_place.rs: -------------------------------------------------------------------------------- 1 | // #2953 2 | 3 | macro_rules! demo { 4 | ($a:ident <- $b:expr) => {}; 5 | } 6 | 7 | fn main() { 8 | demo!(i <- 0); 9 | } 10 | -------------------------------------------------------------------------------- /tests/target/other.rs: -------------------------------------------------------------------------------- 1 | // Part of multiple.rs 2 | 3 | fn bob() { 4 | println!("hello other!"); 5 | } 6 | -------------------------------------------------------------------------------- /tests/target/paren.rs: -------------------------------------------------------------------------------- 1 | fn main() { 2 | let x = (1); 3 | let y = (/* comment */(2)); 4 | let z = ((3)/* comment */); 5 | let a = (4/* comment */); 6 | } 7 | -------------------------------------------------------------------------------- /tests/target/path_clarity/foo.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-edition: 2018 2 | mod bar; 3 | -------------------------------------------------------------------------------- /tests/target/path_clarity/foo/bar.rs: -------------------------------------------------------------------------------- 1 | pub fn fn_in_bar() { 2 | println!("foo/bar.rs"); 3 | } 4 | -------------------------------------------------------------------------------- /tests/target/preserves_carriage_return_for_unix.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-newline_style: Unix 2 | // Foo Bar 3 | -------------------------------------------------------------------------------- /tests/target/preserves_carriage_return_for_windows.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-newline_style: Windows 2 | // Foo Bar 3 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/A2/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/ABCD/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/ZYXW/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/ZYXW_/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/ZY_XW/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/Z_YXW/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/_ZYXW/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/_abcd/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/a1/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/abcd/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/u128/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/u16/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/u256/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/u32/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/u64/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/u8/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/u_zzz/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/ua/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/usize/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/uz/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/v0/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/v00/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/v000/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/v001/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/v009/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/v00t/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/v01/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/v010/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/v09/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/v0s/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/v0u/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/v1/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/v10/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/v9/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/w005s09t/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/w5s009t/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/x64/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/x86/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/x86_128/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/x86_32/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/x86_64/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/x87/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/reorder_modules/zyxw/mod.rs: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /tests/target/return-type-notation.rs: -------------------------------------------------------------------------------- 1 | fn rtn() 2 | where 3 | T: Trait, 4 | T::method(..): Send + 'static, 5 | { 6 | } 7 | 8 | fn test() { 9 | let x: T::method(..); 10 | } 11 | -------------------------------------------------------------------------------- /tests/target/skip/foo.rs: -------------------------------------------------------------------------------- 1 | #![rustfmt::skip] 2 | 3 | fn 4 | foo() 5 | {} 6 | -------------------------------------------------------------------------------- /tests/target/skip/main.rs: -------------------------------------------------------------------------------- 1 | mod foo; 2 | 3 | fn main() { 4 | println!("Hello, world!"); 5 | } 6 | -------------------------------------------------------------------------------- /tests/target/skip/preserve_trailing_comment.rs: -------------------------------------------------------------------------------- 1 | #![rustfmt::skip] 2 | 3 | fn main() { 4 | println!("Hello, world!"); 5 | } 6 | 7 | // Trailing Comment 8 | -------------------------------------------------------------------------------- /tests/target/skip_macro_invocations/all.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-skip_macro_invocations: ["*"] 2 | 3 | // Should skip this invocation 4 | items!( 5 | const _: u8 = 0; 6 | ); 7 | 8 | // Should skip this invocation 9 | renamed_items!( 10 | const _: u8 = 0; 11 | ); 12 | -------------------------------------------------------------------------------- /tests/target/skip_macro_invocations/config_file.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-unstable: true 2 | // rustfmt-config: issue-5816.toml 3 | 4 | fn main() { 5 | println!( "Hello, world!"); 6 | let x = 7; 7 | } 8 | -------------------------------------------------------------------------------- /tests/target/skip_macro_invocations/empty.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-skip_macro_invocations: [] 2 | 3 | // Should not skip this invocation 4 | items!( 5 | const _: u8 = 0; 6 | ); 7 | 8 | // Should not skip this invocation 9 | renamed_items!( 10 | const _: u8 = 0; 11 | ); 12 | -------------------------------------------------------------------------------- /tests/target/skip_macro_invocations/name.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-skip_macro_invocations: ["items"] 2 | 3 | // Should skip this invocation 4 | items!( 5 | const _: u8 = 0; 6 | ); 7 | 8 | // Should not skip this invocation 9 | renamed_items!( 10 | const _: u8 = 0; 11 | ); 12 | -------------------------------------------------------------------------------- /tests/target/skip_macro_invocations/name_unknown.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-skip_macro_invocations: ["unknown"] 2 | 3 | // Should not skip this invocation 4 | items!( 5 | const _: u8 = 0; 6 | ); 7 | -------------------------------------------------------------------------------- /tests/target/skip_macro_invocations/path_qualified_invocation_mismatch.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-skip_macro_invocations: ["items"] 2 | 3 | // Should not skip this invocation 4 | self::items!( 5 | const _: u8 = 0; 6 | ); 7 | -------------------------------------------------------------------------------- /tests/target/skip_macro_invocations/path_qualified_match.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-skip_macro_invocations: ["self::items"] 2 | 3 | // Should skip this invocation 4 | self::items!( 5 | const _: u8 = 0; 6 | ); 7 | -------------------------------------------------------------------------------- /tests/target/skip_macro_invocations/path_qualified_name_mismatch.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-skip_macro_invocations: ["self::items"] 2 | 3 | // Should not skip this invocation 4 | items!( 5 | const _: u8 = 0; 6 | ); 7 | -------------------------------------------------------------------------------- /tests/target/skip_mod.rs: -------------------------------------------------------------------------------- 1 | #![rustfmt::skip] 2 | use a :: b 3 | ; 4 | -------------------------------------------------------------------------------- /tests/target/space-not-before-newline.rs: -------------------------------------------------------------------------------- 1 | struct Foo { 2 | a: (), 3 | // spaces ^^^ to be removed 4 | } 5 | enum Foo { 6 | Bar, 7 | // spaces ^^^ to be removed 8 | } 9 | -------------------------------------------------------------------------------- /tests/target/tuple_v2.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-style_edition: 2024 2 | 3 | fn issue_4355() { 4 | let _ = ((1,),).0.0; 5 | } 6 | -------------------------------------------------------------------------------- /tests/target/unsafe-field.rs: -------------------------------------------------------------------------------- 1 | #![feature(unsafe_fields)] 2 | 3 | struct Foo { 4 | unsafe field: (), 5 | } 6 | 7 | enum Bar { 8 | Variant { unsafe field: () }, 9 | } 10 | 11 | union Baz { 12 | unsafe field: (), 13 | } 14 | -------------------------------------------------------------------------------- /tests/target/unsafe-mod.rs: -------------------------------------------------------------------------------- 1 | // These are supported by rustc syntactically but not semantically. 2 | 3 | #[cfg(any())] 4 | unsafe mod m {} 5 | 6 | #[cfg(any())] 7 | unsafe extern "C++" {} 8 | -------------------------------------------------------------------------------- /tests/target/visibility.rs: -------------------------------------------------------------------------------- 1 | // #2398 2 | pub mod outer_mod { 3 | pub mod inner_mod { 4 | pub(in outer_mod) fn outer_mod_visible_fn() {} 5 | pub(super) fn super_mod_visible_fn() {} 6 | pub(self) fn inner_mod_visible_fn() {} 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /tests/writemode/source/modified.rs: -------------------------------------------------------------------------------- 1 | // rustfmt-write_mode: modified 2 | // Test "modified" output 3 | 4 | fn 5 | blah 6 | () 7 | { } 8 | 9 | 10 | #[cfg 11 | ( a , b 12 | )] 13 | fn 14 | main() {} 15 | -------------------------------------------------------------------------------- /tests/writemode/source/stdin.rs: -------------------------------------------------------------------------------- 1 | 2 | fn 3 | some( ) 4 | { 5 | } 6 | fn main () {} 7 | -------------------------------------------------------------------------------- /tests/writemode/target/modified.txt: -------------------------------------------------------------------------------- 1 | 4 4 1 2 | fn blah() {} 3 | 10 5 2 4 | #[cfg(a, b)] 5 | fn main() {} 6 | -------------------------------------------------------------------------------- /tests/writemode/target/stdin.json: -------------------------------------------------------------------------------- 1 | [{"name":"","mismatches":[{"original_begin_line":1,"original_end_line":6,"expected_begin_line":1,"expected_end_line":2,"original":"\nfn\n some( )\n{\n}\nfn main () {}\n","expected":"fn some() {}\nfn main() {}\n"}]}] 2 | -------------------------------------------------------------------------------- /triagebot.toml: -------------------------------------------------------------------------------- 1 | [autolabel."pr-not-reviewed"] 2 | new_pr = true 3 | 4 | [assign] 5 | --------------------------------------------------------------------------------