From 16b91be3e6a368d4358619269e89fdd163990da9 Mon Sep 17 00:00:00 2001 From: Vincent Esche Date: Sun, 30 Apr 2017 23:49:39 +0200 Subject: [PATCH] Add source/target tests for each config option --- tests/source/configs-array_layout-block.rs | 6 ++++ tests/source/configs-array_layout-visual.rs | 6 ++++ tests/source/configs-array_width-above.rs | 6 ++++ tests/source/configs-array_width-below.rs | 6 ++++ tests/source/configs-chain_indent-block.rs | 6 ++++ tests/source/configs-chain_indent-visual.rs | 6 ++++ .../configs-chain_one_line_max-above.rs | 6 ++++ .../configs-chain_one_line_max-below.rs | 6 ++++ ...nfigs-closure_block_indent_threshold-10.rs | 12 +++++++ ...onfigs-closure_block_indent_threshold-2.rs | 12 +++++++ tests/source/configs-comment_width-above.rs | 7 ++++ tests/source/configs-comment_width-below.rs | 7 ++++ tests/source/configs-comment_width-ignore.rs | 7 ++++ ...onfigs-condense_wildcard_suffices-false.rs | 6 ++++ ...configs-condense_wildcard_suffices-true.rs | 6 ++++ ...gs-control_brace_style-always_next_line.rs | 6 ++++ ...gs-control_brace_style-always_same_line.rs | 6 ++++ ...s-control_brace_style-closing_next_line.rs | 6 ++++ .../configs-disable_all_formatting-false.rs | 6 ++++ .../configs-disable_all_formatting-true.rs | 6 ++++ .../configs-error_on_line_overflow-false.rs | 6 ++++ .../configs-fn_args_density-compressed.rs | 16 +++++++++ ...igs-fn_args_density-compressed_if_empty.rs | 20 +++++++++++ tests/source/configs-fn_args_density-tall.rs | 16 +++++++++ .../configs-fn_args_density-vertical.rs | 16 +++++++++ tests/source/configs-fn_args_layout-block.rs | 10 ++++++ tests/source/configs-fn_args_layout-visual.rs | 10 ++++++ .../configs-fn_args_paren_newline-false.rs | 6 ++++ .../configs-fn_args_paren_newline-true.rs | 6 ++++ ...configs-fn_brace_style-always_next_line.rs | 14 ++++++++ ...configs-fn_brace_style-prefer_same_line.rs | 14 ++++++++ .../configs-fn_brace_style-same_line_where.rs | 14 ++++++++ tests/source/configs-fn_call_style-block.rs | 6 ++++ tests/source/configs-fn_call_style-visual.rs | 6 ++++ tests/source/configs-fn_call_width-above.rs | 6 ++++ tests/source/configs-fn_call_width-below.rs | 6 ++++ .../configs-fn_empty_single_line-false.rs | 9 +++++ .../configs-fn_empty_single_line-true.rs | 9 +++++ .../configs-fn_return_indent-with_args.rs | 6 ++++ ...figs-fn_return_indent-with_where_clause.rs | 6 ++++ tests/source/configs-fn_single_line-false.rs | 11 ++++++ tests/source/configs-fn_single_line-true.rs | 11 ++++++ .../configs-force_explicit_abi-false.rs | 6 ++++ .../source/configs-force_explicit_abi-true.rs | 6 ++++ .../configs-force_format_strings-false.rs | 9 +++++ .../configs-force_format_strings-true.rs | 8 +++++ tests/source/configs-format_strings-false.rs | 8 +++++ tests/source/configs-format_strings-true.rs | 7 ++++ tests/source/configs-generics_indent-block.rs | 6 ++++ .../source/configs-generics_indent-visual.rs | 6 ++++ tests/source/configs-hard_tabs-false.rs | 6 ++++ tests/source/configs-hard_tabs-true.rs | 6 ++++ .../configs-impl_empty_single_line-false.rs | 10 ++++++ .../configs-impl_empty_single_line-true.rs | 10 ++++++ .../source/configs-indent_match_arms-false.rs | 8 +++++ .../source/configs-indent_match_arms-true.rs | 8 +++++ ...nfigs-item_brace_style-always_next_line.rs | 10 ++++++ ...nfigs-item_brace_style-prefer_same_line.rs | 10 ++++++ ...onfigs-item_brace_style-same_line_where.rs | 10 ++++++ ...onfigs-match_block_trailing_comma-false.rs | 11 ++++++ ...configs-match_block_trailing_comma-true.rs | 11 ++++++ .../configs-normalize_comments-false.rs | 8 +++++ .../source/configs-normalize_comments-true.rs | 8 +++++ .../configs-reorder_imported_names-false.rs | 4 +++ .../configs-reorder_imported_names-true.rs | 4 +++ tests/source/configs-reorder_imports-false.rs | 7 ++++ tests/source/configs-reorder_imports-true.rs | 7 ++++ ...igs-single_line_if_else_max_width-above.rs | 6 ++++ ...igs-single_line_if_else_max_width-below.rs | 6 ++++ .../configs-space_after_bound_colon-false.rs | 6 ++++ .../configs-space_after_bound_colon-true.rs | 6 ++++ ...space_after_type_annotation_colon-false.rs | 6 ++++ ...-space_after_type_annotation_colon-true.rs | 6 ++++ .../configs-space_before_bound-false.rs | 6 ++++ .../source/configs-space_before_bound-true.rs | 6 ++++ ...figs-space_before_type_annotation-false.rs | 6 ++++ ...nfigs-space_before_type_annotation-true.rs | 6 ++++ .../configs-spaces_around_ranges-false.rs | 6 ++++ .../configs-spaces_around_ranges-true.rs | 6 ++++ ...figs-spaces_within_angle_brackets-false.rs | 6 ++++ ...nfigs-spaces_within_angle_brackets-true.rs | 6 ++++ .../configs-spaces_within_parens-false.rs | 6 ++++ .../configs-spaces_within_parens-true.rs | 6 ++++ ...igs-spaces_within_square_brackets-false.rs | 6 ++++ ...figs-spaces_within_square_brackets-true.rs | 6 ++++ ...-struct_lit_multiline_style-force_multi.rs | 6 ++++ ...truct_lit_multiline_style-prefer_single.rs | 7 ++++ .../source/configs-struct_lit_style-block.rs | 6 ++++ .../source/configs-struct_lit_style-visual.rs | 6 ++++ .../source/configs-struct_lit_width-above.rs | 6 ++++ .../source/configs-struct_lit_width-below.rs | 6 ++++ .../configs-struct_variant_width-above.rs | 8 +++++ .../configs-struct_variant_width-below.rs | 8 +++++ tests/source/configs-tab_spaces-2.rs | 11 ++++++ tests/source/configs-tab_spaces-4.rs | 11 ++++++ tests/source/configs-trailing_comma-always.rs | 7 ++++ tests/source/configs-trailing_comma-never.rs | 7 ++++ .../source/configs-trailing_comma-vertical.rs | 7 ++++ ...igs-type_punctuation_density-compressed.rs | 7 ++++ .../configs-type_punctuation_density-wide.rs | 6 ++++ .../source/configs-use_try_shorthand-false.rs | 6 ++++ .../source/configs-use_try_shorthand-true.rs | 6 ++++ .../configs-where_density-compressed.rs | 10 ++++++ ...nfigs-where_density-compressed_if_empty.rs | 10 ++++++ tests/source/configs-where_density-tall.rs | 10 ++++++ .../source/configs-where_density-vertical.rs | 10 ++++++ .../source/configs-where_layout-horizontal.rs | 11 ++++++ ...onfigs-where_layout-horizontal_vertical.rs | 10 ++++++ tests/source/configs-where_layout-mixed.rs | 10 ++++++ tests/source/configs-where_layout-vertical.rs | 10 ++++++ .../source/configs-where_pred_indent-block.rs | 6 ++++ .../configs-where_pred_indent-visual.rs | 6 ++++ tests/source/configs-where_style-default.rs | 6 ++++ tests/source/configs-where_style-rfc.rs | 6 ++++ tests/source/configs-wrap_comments-false.rs | 8 +++++ tests/source/configs-wrap_comments-true.rs | 7 ++++ tests/source/configs-wrap_match_arms-false.rs | 14 ++++++++ tests/source/configs-wrap_match_arms-true.rs | 14 ++++++++ tests/target/configs-array_layout-block.rs | 14 ++++++++ tests/target/configs-array_layout-visual.rs | 12 +++++++ tests/target/configs-array_width-above.rs | 12 +++++++ tests/target/configs-array_width-below.rs | 6 ++++ tests/target/configs-chain_indent-block.rs | 12 +++++++ tests/target/configs-chain_indent-visual.rs | 11 ++++++ .../configs-chain_one_line_max-above.rs | 12 +++++++ .../configs-chain_one_line_max-below.rs | 6 ++++ ...nfigs-closure_block_indent_threshold-10.rs | 12 +++++++ ...onfigs-closure_block_indent_threshold-2.rs | 12 +++++++ tests/target/configs-comment_width-above.rs | 8 +++++ tests/target/configs-comment_width-below.rs | 7 ++++ tests/target/configs-comment_width-ignore.rs | 7 ++++ ...onfigs-condense_wildcard_suffices-false.rs | 6 ++++ ...configs-condense_wildcard_suffices-true.rs | 6 ++++ ...gs-control_brace_style-always_next_line.rs | 13 +++++++ ...gs-control_brace_style-always_same_line.rs | 10 ++++++ ...s-control_brace_style-closing_next_line.rs | 11 ++++++ .../configs-disable_all_formatting-false.rs | 10 ++++++ .../configs-disable_all_formatting-true.rs | 6 ++++ .../configs-error_on_line_overflow-false.rs | 6 ++++ .../configs-fn_args_density-compressed.rs | 18 ++++++++++ ...igs-fn_args_density-compressed_if_empty.rs | 32 +++++++++++++++++ tests/target/configs-fn_args_density-tall.rs | 28 +++++++++++++++ .../configs-fn_args_density-vertical.rs | 34 +++++++++++++++++++ tests/target/configs-fn_args_layout-block.rs | 18 ++++++++++ tests/target/configs-fn_args_layout-visual.rs | 16 +++++++++ .../configs-fn_args_paren_newline-false.rs | 11 ++++++ .../configs-fn_args_paren_newline-true.rs | 11 ++++++ ...configs-fn_brace_style-always_next_line.rs | 18 ++++++++++ ...configs-fn_brace_style-prefer_same_line.rs | 15 ++++++++ .../configs-fn_brace_style-same_line_where.rs | 16 +++++++++ tests/target/configs-fn_call_style-block.rs | 15 ++++++++ tests/target/configs-fn_call_style-visual.rs | 13 +++++++ tests/target/configs-fn_call_width-above.rs | 13 +++++++ tests/target/configs-fn_call_width-below.rs | 6 ++++ .../configs-fn_empty_single_line-false.rs | 9 +++++ .../configs-fn_empty_single_line-true.rs | 6 ++++ .../configs-fn_return_indent-with_args.rs | 14 ++++++++ ...figs-fn_return_indent-with_where_clause.rs | 14 ++++++++ tests/target/configs-fn_single_line-false.rs | 11 ++++++ tests/target/configs-fn_single_line-true.rs | 9 +++++ .../configs-force_explicit_abi-false.rs | 6 ++++ .../target/configs-force_explicit_abi-true.rs | 6 ++++ .../configs-force_format_strings-false.rs | 9 +++++ .../configs-force_format_strings-true.rs | 10 ++++++ tests/target/configs-format_strings-false.rs | 8 +++++ tests/target/configs-format_strings-true.rs | 9 +++++ tests/target/configs-generics_indent-block.rs | 21 ++++++++++++ .../target/configs-generics_indent-visual.rs | 20 +++++++++++ tests/target/configs-hard_tabs-false.rs | 6 ++++ tests/target/configs-hard_tabs-true.rs | 6 ++++ .../configs-impl_empty_single_line-false.rs | 8 +++++ .../configs-impl_empty_single_line-true.rs | 6 ++++ .../target/configs-indent_match_arms-false.rs | 11 ++++++ .../target/configs-indent_match_arms-true.rs | 11 ++++++ ...nfigs-item_brace_style-always_next_line.rs | 13 +++++++ ...nfigs-item_brace_style-prefer_same_line.rs | 11 ++++++ ...onfigs-item_brace_style-same_line_where.rs | 12 +++++++ ...onfigs-match_block_trailing_comma-false.rs | 11 ++++++ ...configs-match_block_trailing_comma-true.rs | 11 ++++++ .../configs-normalize_comments-false.rs | 8 +++++ .../target/configs-normalize_comments-true.rs | 8 +++++ .../configs-reorder_imported_names-false.rs | 4 +++ .../configs-reorder_imported_names-true.rs | 4 +++ tests/target/configs-reorder_imports-false.rs | 7 ++++ tests/target/configs-reorder_imports-true.rs | 7 ++++ ...igs-single_line_if_else_max_width-above.rs | 10 ++++++ ...igs-single_line_if_else_max_width-below.rs | 6 ++++ .../configs-space_after_bound_colon-false.rs | 6 ++++ .../configs-space_after_bound_colon-true.rs | 6 ++++ ...space_after_type_annotation_colon-false.rs | 6 ++++ ...-space_after_type_annotation_colon-true.rs | 6 ++++ .../configs-space_before_bound-false.rs | 6 ++++ .../target/configs-space_before_bound-true.rs | 6 ++++ ...figs-space_before_type_annotation-false.rs | 6 ++++ ...nfigs-space_before_type_annotation-true.rs | 6 ++++ .../configs-spaces_around_ranges-false.rs | 6 ++++ .../configs-spaces_around_ranges-true.rs | 6 ++++ ...figs-spaces_within_angle_brackets-false.rs | 6 ++++ ...nfigs-spaces_within_angle_brackets-true.rs | 6 ++++ .../configs-spaces_within_parens-false.rs | 6 ++++ .../configs-spaces_within_parens-true.rs | 6 ++++ ...igs-spaces_within_square_brackets-false.rs | 6 ++++ ...figs-spaces_within_square_brackets-true.rs | 6 ++++ ...-struct_lit_multiline_style-force_multi.rs | 9 +++++ ...truct_lit_multiline_style-prefer_single.rs | 7 ++++ .../target/configs-struct_lit_style-block.rs | 9 +++++ .../target/configs-struct_lit_style-visual.rs | 7 ++++ .../target/configs-struct_lit_width-above.rs | 9 +++++ .../target/configs-struct_lit_width-below.rs | 6 ++++ .../configs-struct_variant_width-above.rs | 11 ++++++ .../configs-struct_variant_width-below.rs | 8 +++++ tests/target/configs-tab_spaces-2.rs | 14 ++++++++ tests/target/configs-tab_spaces-4.rs | 14 ++++++++ tests/target/configs-trailing_comma-always.rs | 14 ++++++++ tests/target/configs-trailing_comma-never.rs | 14 ++++++++ .../target/configs-trailing_comma-vertical.rs | 14 ++++++++ ...igs-type_punctuation_density-compressed.rs | 7 ++++ .../configs-type_punctuation_density-wide.rs | 6 ++++ .../target/configs-use_try_shorthand-false.rs | 6 ++++ .../target/configs-use_try_shorthand-true.rs | 6 ++++ .../configs-where_density-compressed.rs | 10 ++++++ ...nfigs-where_density-compressed_if_empty.rs | 12 +++++++ tests/target/configs-where_density-tall.rs | 13 +++++++ .../target/configs-where_density-vertical.rs | 13 +++++++ .../target/configs-where_layout-horizontal.rs | 15 ++++++++ ...onfigs-where_layout-horizontal_vertical.rs | 17 ++++++++++ tests/target/configs-where_layout-mixed.rs | 15 ++++++++ tests/target/configs-where_layout-vertical.rs | 18 ++++++++++ .../target/configs-where_pred_indent-block.rs | 11 ++++++ .../configs-where_pred_indent-visual.rs | 11 ++++++ tests/target/configs-where_style-default.rs | 11 ++++++ tests/target/configs-where_style-rfc.rs | 12 +++++++ tests/target/configs-wrap_comments-false.rs | 8 +++++ tests/target/configs-wrap_comments-true.rs | 12 +++++++ tests/target/configs-wrap_match_arms-false.rs | 14 ++++++++ tests/target/configs-wrap_match_arms-true.rs | 12 +++++++ 236 files changed, 2166 insertions(+) create mode 100644 tests/source/configs-array_layout-block.rs create mode 100644 tests/source/configs-array_layout-visual.rs create mode 100644 tests/source/configs-array_width-above.rs create mode 100644 tests/source/configs-array_width-below.rs create mode 100644 tests/source/configs-chain_indent-block.rs create mode 100644 tests/source/configs-chain_indent-visual.rs create mode 100644 tests/source/configs-chain_one_line_max-above.rs create mode 100644 tests/source/configs-chain_one_line_max-below.rs create mode 100644 tests/source/configs-closure_block_indent_threshold-10.rs create mode 100644 tests/source/configs-closure_block_indent_threshold-2.rs create mode 100644 tests/source/configs-comment_width-above.rs create mode 100644 tests/source/configs-comment_width-below.rs create mode 100644 tests/source/configs-comment_width-ignore.rs create mode 100644 tests/source/configs-condense_wildcard_suffices-false.rs create mode 100644 tests/source/configs-condense_wildcard_suffices-true.rs create mode 100644 tests/source/configs-control_brace_style-always_next_line.rs create mode 100644 tests/source/configs-control_brace_style-always_same_line.rs create mode 100644 tests/source/configs-control_brace_style-closing_next_line.rs create mode 100644 tests/source/configs-disable_all_formatting-false.rs create mode 100644 tests/source/configs-disable_all_formatting-true.rs create mode 100644 tests/source/configs-error_on_line_overflow-false.rs create mode 100644 tests/source/configs-fn_args_density-compressed.rs create mode 100644 tests/source/configs-fn_args_density-compressed_if_empty.rs create mode 100644 tests/source/configs-fn_args_density-tall.rs create mode 100644 tests/source/configs-fn_args_density-vertical.rs create mode 100644 tests/source/configs-fn_args_layout-block.rs create mode 100644 tests/source/configs-fn_args_layout-visual.rs create mode 100644 tests/source/configs-fn_args_paren_newline-false.rs create mode 100644 tests/source/configs-fn_args_paren_newline-true.rs create mode 100644 tests/source/configs-fn_brace_style-always_next_line.rs create mode 100644 tests/source/configs-fn_brace_style-prefer_same_line.rs create mode 100644 tests/source/configs-fn_brace_style-same_line_where.rs create mode 100644 tests/source/configs-fn_call_style-block.rs create mode 100644 tests/source/configs-fn_call_style-visual.rs create mode 100644 tests/source/configs-fn_call_width-above.rs create mode 100644 tests/source/configs-fn_call_width-below.rs create mode 100644 tests/source/configs-fn_empty_single_line-false.rs create mode 100644 tests/source/configs-fn_empty_single_line-true.rs create mode 100644 tests/source/configs-fn_return_indent-with_args.rs create mode 100644 tests/source/configs-fn_return_indent-with_where_clause.rs create mode 100644 tests/source/configs-fn_single_line-false.rs create mode 100644 tests/source/configs-fn_single_line-true.rs create mode 100644 tests/source/configs-force_explicit_abi-false.rs create mode 100644 tests/source/configs-force_explicit_abi-true.rs create mode 100644 tests/source/configs-force_format_strings-false.rs create mode 100644 tests/source/configs-force_format_strings-true.rs create mode 100644 tests/source/configs-format_strings-false.rs create mode 100644 tests/source/configs-format_strings-true.rs create mode 100644 tests/source/configs-generics_indent-block.rs create mode 100644 tests/source/configs-generics_indent-visual.rs create mode 100644 tests/source/configs-hard_tabs-false.rs create mode 100644 tests/source/configs-hard_tabs-true.rs create mode 100644 tests/source/configs-impl_empty_single_line-false.rs create mode 100644 tests/source/configs-impl_empty_single_line-true.rs create mode 100644 tests/source/configs-indent_match_arms-false.rs create mode 100644 tests/source/configs-indent_match_arms-true.rs create mode 100644 tests/source/configs-item_brace_style-always_next_line.rs create mode 100644 tests/source/configs-item_brace_style-prefer_same_line.rs create mode 100644 tests/source/configs-item_brace_style-same_line_where.rs create mode 100644 tests/source/configs-match_block_trailing_comma-false.rs create mode 100644 tests/source/configs-match_block_trailing_comma-true.rs create mode 100644 tests/source/configs-normalize_comments-false.rs create mode 100644 tests/source/configs-normalize_comments-true.rs create mode 100644 tests/source/configs-reorder_imported_names-false.rs create mode 100644 tests/source/configs-reorder_imported_names-true.rs create mode 100644 tests/source/configs-reorder_imports-false.rs create mode 100644 tests/source/configs-reorder_imports-true.rs create mode 100644 tests/source/configs-single_line_if_else_max_width-above.rs create mode 100644 tests/source/configs-single_line_if_else_max_width-below.rs create mode 100644 tests/source/configs-space_after_bound_colon-false.rs create mode 100644 tests/source/configs-space_after_bound_colon-true.rs create mode 100644 tests/source/configs-space_after_type_annotation_colon-false.rs create mode 100644 tests/source/configs-space_after_type_annotation_colon-true.rs create mode 100644 tests/source/configs-space_before_bound-false.rs create mode 100644 tests/source/configs-space_before_bound-true.rs create mode 100644 tests/source/configs-space_before_type_annotation-false.rs create mode 100644 tests/source/configs-space_before_type_annotation-true.rs create mode 100644 tests/source/configs-spaces_around_ranges-false.rs create mode 100644 tests/source/configs-spaces_around_ranges-true.rs create mode 100644 tests/source/configs-spaces_within_angle_brackets-false.rs create mode 100644 tests/source/configs-spaces_within_angle_brackets-true.rs create mode 100644 tests/source/configs-spaces_within_parens-false.rs create mode 100644 tests/source/configs-spaces_within_parens-true.rs create mode 100644 tests/source/configs-spaces_within_square_brackets-false.rs create mode 100644 tests/source/configs-spaces_within_square_brackets-true.rs create mode 100644 tests/source/configs-struct_lit_multiline_style-force_multi.rs create mode 100644 tests/source/configs-struct_lit_multiline_style-prefer_single.rs create mode 100644 tests/source/configs-struct_lit_style-block.rs create mode 100644 tests/source/configs-struct_lit_style-visual.rs create mode 100644 tests/source/configs-struct_lit_width-above.rs create mode 100644 tests/source/configs-struct_lit_width-below.rs create mode 100644 tests/source/configs-struct_variant_width-above.rs create mode 100644 tests/source/configs-struct_variant_width-below.rs create mode 100644 tests/source/configs-tab_spaces-2.rs create mode 100644 tests/source/configs-tab_spaces-4.rs create mode 100644 tests/source/configs-trailing_comma-always.rs create mode 100644 tests/source/configs-trailing_comma-never.rs create mode 100644 tests/source/configs-trailing_comma-vertical.rs create mode 100644 tests/source/configs-type_punctuation_density-compressed.rs create mode 100644 tests/source/configs-type_punctuation_density-wide.rs create mode 100644 tests/source/configs-use_try_shorthand-false.rs create mode 100644 tests/source/configs-use_try_shorthand-true.rs create mode 100644 tests/source/configs-where_density-compressed.rs create mode 100644 tests/source/configs-where_density-compressed_if_empty.rs create mode 100644 tests/source/configs-where_density-tall.rs create mode 100644 tests/source/configs-where_density-vertical.rs create mode 100644 tests/source/configs-where_layout-horizontal.rs create mode 100644 tests/source/configs-where_layout-horizontal_vertical.rs create mode 100644 tests/source/configs-where_layout-mixed.rs create mode 100644 tests/source/configs-where_layout-vertical.rs create mode 100644 tests/source/configs-where_pred_indent-block.rs create mode 100644 tests/source/configs-where_pred_indent-visual.rs create mode 100644 tests/source/configs-where_style-default.rs create mode 100644 tests/source/configs-where_style-rfc.rs create mode 100644 tests/source/configs-wrap_comments-false.rs create mode 100644 tests/source/configs-wrap_comments-true.rs create mode 100644 tests/source/configs-wrap_match_arms-false.rs create mode 100644 tests/source/configs-wrap_match_arms-true.rs create mode 100644 tests/target/configs-array_layout-block.rs create mode 100644 tests/target/configs-array_layout-visual.rs create mode 100644 tests/target/configs-array_width-above.rs create mode 100644 tests/target/configs-array_width-below.rs create mode 100644 tests/target/configs-chain_indent-block.rs create mode 100644 tests/target/configs-chain_indent-visual.rs create mode 100644 tests/target/configs-chain_one_line_max-above.rs create mode 100644 tests/target/configs-chain_one_line_max-below.rs create mode 100644 tests/target/configs-closure_block_indent_threshold-10.rs create mode 100644 tests/target/configs-closure_block_indent_threshold-2.rs create mode 100644 tests/target/configs-comment_width-above.rs create mode 100644 tests/target/configs-comment_width-below.rs create mode 100644 tests/target/configs-comment_width-ignore.rs create mode 100644 tests/target/configs-condense_wildcard_suffices-false.rs create mode 100644 tests/target/configs-condense_wildcard_suffices-true.rs create mode 100644 tests/target/configs-control_brace_style-always_next_line.rs create mode 100644 tests/target/configs-control_brace_style-always_same_line.rs create mode 100644 tests/target/configs-control_brace_style-closing_next_line.rs create mode 100644 tests/target/configs-disable_all_formatting-false.rs create mode 100644 tests/target/configs-disable_all_formatting-true.rs create mode 100644 tests/target/configs-error_on_line_overflow-false.rs create mode 100644 tests/target/configs-fn_args_density-compressed.rs create mode 100644 tests/target/configs-fn_args_density-compressed_if_empty.rs create mode 100644 tests/target/configs-fn_args_density-tall.rs create mode 100644 tests/target/configs-fn_args_density-vertical.rs create mode 100644 tests/target/configs-fn_args_layout-block.rs create mode 100644 tests/target/configs-fn_args_layout-visual.rs create mode 100644 tests/target/configs-fn_args_paren_newline-false.rs create mode 100644 tests/target/configs-fn_args_paren_newline-true.rs create mode 100644 tests/target/configs-fn_brace_style-always_next_line.rs create mode 100644 tests/target/configs-fn_brace_style-prefer_same_line.rs create mode 100644 tests/target/configs-fn_brace_style-same_line_where.rs create mode 100644 tests/target/configs-fn_call_style-block.rs create mode 100644 tests/target/configs-fn_call_style-visual.rs create mode 100644 tests/target/configs-fn_call_width-above.rs create mode 100644 tests/target/configs-fn_call_width-below.rs create mode 100644 tests/target/configs-fn_empty_single_line-false.rs create mode 100644 tests/target/configs-fn_empty_single_line-true.rs create mode 100644 tests/target/configs-fn_return_indent-with_args.rs create mode 100644 tests/target/configs-fn_return_indent-with_where_clause.rs create mode 100644 tests/target/configs-fn_single_line-false.rs create mode 100644 tests/target/configs-fn_single_line-true.rs create mode 100644 tests/target/configs-force_explicit_abi-false.rs create mode 100644 tests/target/configs-force_explicit_abi-true.rs create mode 100644 tests/target/configs-force_format_strings-false.rs create mode 100644 tests/target/configs-force_format_strings-true.rs create mode 100644 tests/target/configs-format_strings-false.rs create mode 100644 tests/target/configs-format_strings-true.rs create mode 100644 tests/target/configs-generics_indent-block.rs create mode 100644 tests/target/configs-generics_indent-visual.rs create mode 100644 tests/target/configs-hard_tabs-false.rs create mode 100644 tests/target/configs-hard_tabs-true.rs create mode 100644 tests/target/configs-impl_empty_single_line-false.rs create mode 100644 tests/target/configs-impl_empty_single_line-true.rs create mode 100644 tests/target/configs-indent_match_arms-false.rs create mode 100644 tests/target/configs-indent_match_arms-true.rs create mode 100644 tests/target/configs-item_brace_style-always_next_line.rs create mode 100644 tests/target/configs-item_brace_style-prefer_same_line.rs create mode 100644 tests/target/configs-item_brace_style-same_line_where.rs create mode 100644 tests/target/configs-match_block_trailing_comma-false.rs create mode 100644 tests/target/configs-match_block_trailing_comma-true.rs create mode 100644 tests/target/configs-normalize_comments-false.rs create mode 100644 tests/target/configs-normalize_comments-true.rs create mode 100644 tests/target/configs-reorder_imported_names-false.rs create mode 100644 tests/target/configs-reorder_imported_names-true.rs create mode 100644 tests/target/configs-reorder_imports-false.rs create mode 100644 tests/target/configs-reorder_imports-true.rs create mode 100644 tests/target/configs-single_line_if_else_max_width-above.rs create mode 100644 tests/target/configs-single_line_if_else_max_width-below.rs create mode 100644 tests/target/configs-space_after_bound_colon-false.rs create mode 100644 tests/target/configs-space_after_bound_colon-true.rs create mode 100644 tests/target/configs-space_after_type_annotation_colon-false.rs create mode 100644 tests/target/configs-space_after_type_annotation_colon-true.rs create mode 100644 tests/target/configs-space_before_bound-false.rs create mode 100644 tests/target/configs-space_before_bound-true.rs create mode 100644 tests/target/configs-space_before_type_annotation-false.rs create mode 100644 tests/target/configs-space_before_type_annotation-true.rs create mode 100644 tests/target/configs-spaces_around_ranges-false.rs create mode 100644 tests/target/configs-spaces_around_ranges-true.rs create mode 100644 tests/target/configs-spaces_within_angle_brackets-false.rs create mode 100644 tests/target/configs-spaces_within_angle_brackets-true.rs create mode 100644 tests/target/configs-spaces_within_parens-false.rs create mode 100644 tests/target/configs-spaces_within_parens-true.rs create mode 100644 tests/target/configs-spaces_within_square_brackets-false.rs create mode 100644 tests/target/configs-spaces_within_square_brackets-true.rs create mode 100644 tests/target/configs-struct_lit_multiline_style-force_multi.rs create mode 100644 tests/target/configs-struct_lit_multiline_style-prefer_single.rs create mode 100644 tests/target/configs-struct_lit_style-block.rs create mode 100644 tests/target/configs-struct_lit_style-visual.rs create mode 100644 tests/target/configs-struct_lit_width-above.rs create mode 100644 tests/target/configs-struct_lit_width-below.rs create mode 100644 tests/target/configs-struct_variant_width-above.rs create mode 100644 tests/target/configs-struct_variant_width-below.rs create mode 100644 tests/target/configs-tab_spaces-2.rs create mode 100644 tests/target/configs-tab_spaces-4.rs create mode 100644 tests/target/configs-trailing_comma-always.rs create mode 100644 tests/target/configs-trailing_comma-never.rs create mode 100644 tests/target/configs-trailing_comma-vertical.rs create mode 100644 tests/target/configs-type_punctuation_density-compressed.rs create mode 100644 tests/target/configs-type_punctuation_density-wide.rs create mode 100644 tests/target/configs-use_try_shorthand-false.rs create mode 100644 tests/target/configs-use_try_shorthand-true.rs create mode 100644 tests/target/configs-where_density-compressed.rs create mode 100644 tests/target/configs-where_density-compressed_if_empty.rs create mode 100644 tests/target/configs-where_density-tall.rs create mode 100644 tests/target/configs-where_density-vertical.rs create mode 100644 tests/target/configs-where_layout-horizontal.rs create mode 100644 tests/target/configs-where_layout-horizontal_vertical.rs create mode 100644 tests/target/configs-where_layout-mixed.rs create mode 100644 tests/target/configs-where_layout-vertical.rs create mode 100644 tests/target/configs-where_pred_indent-block.rs create mode 100644 tests/target/configs-where_pred_indent-visual.rs create mode 100644 tests/target/configs-where_style-default.rs create mode 100644 tests/target/configs-where_style-rfc.rs create mode 100644 tests/target/configs-wrap_comments-false.rs create mode 100644 tests/target/configs-wrap_comments-true.rs create mode 100644 tests/target/configs-wrap_match_arms-false.rs create mode 100644 tests/target/configs-wrap_match_arms-true.rs diff --git a/tests/source/configs-array_layout-block.rs b/tests/source/configs-array_layout-block.rs new file mode 100644 index 00000000000..02f38a836c3 --- /dev/null +++ b/tests/source/configs-array_layout-block.rs @@ -0,0 +1,6 @@ +// rustfmt-array_layout: Block +// Array layout + +fn main() { + let lorem = vec!["ipsum","dolor","sit","amet","consectetur","adipiscing","elit"]; +} diff --git a/tests/source/configs-array_layout-visual.rs b/tests/source/configs-array_layout-visual.rs new file mode 100644 index 00000000000..fa0d33a7edf --- /dev/null +++ b/tests/source/configs-array_layout-visual.rs @@ -0,0 +1,6 @@ +// rustfmt-array_layout: Visual +// Array layout + +fn main() { + let lorem = vec!["ipsum","dolor","sit","amet","consectetur","adipiscing","elit"]; +} diff --git a/tests/source/configs-array_width-above.rs b/tests/source/configs-array_width-above.rs new file mode 100644 index 00000000000..020a984438e --- /dev/null +++ b/tests/source/configs-array_width-above.rs @@ -0,0 +1,6 @@ +// rustfmt-array_width: 10 +// Array width + +fn main() { + let lorem = vec!["ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit"]; +} diff --git a/tests/source/configs-array_width-below.rs b/tests/source/configs-array_width-below.rs new file mode 100644 index 00000000000..d76d539773a --- /dev/null +++ b/tests/source/configs-array_width-below.rs @@ -0,0 +1,6 @@ +// rustfmt-array_width: 100 +// Array width + +fn main() { + let lorem = vec!["ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit"]; +} diff --git a/tests/source/configs-chain_indent-block.rs b/tests/source/configs-chain_indent-block.rs new file mode 100644 index 00000000000..264e96625fe --- /dev/null +++ b/tests/source/configs-chain_indent-block.rs @@ -0,0 +1,6 @@ +// rustfmt-chain_indent: Block +// Chain indent + +fn main() { + let lorem = ipsum.dolor().sit().amet().consectetur().adipiscing().elit(); +} diff --git a/tests/source/configs-chain_indent-visual.rs b/tests/source/configs-chain_indent-visual.rs new file mode 100644 index 00000000000..3c85400daa4 --- /dev/null +++ b/tests/source/configs-chain_indent-visual.rs @@ -0,0 +1,6 @@ +// rustfmt-chain_indent: Visual +// Chain indent + +fn main() { + let lorem = ipsum.dolor().sit().amet().consectetur().adipiscing().elit(); +} diff --git a/tests/source/configs-chain_one_line_max-above.rs b/tests/source/configs-chain_one_line_max-above.rs new file mode 100644 index 00000000000..6e72c09b215 --- /dev/null +++ b/tests/source/configs-chain_one_line_max-above.rs @@ -0,0 +1,6 @@ +// rustfmt-chain_one_line_max: 10 +// Chain one line max + +fn main() { + let lorem = ipsum.dolor().sit().amet().consectetur().adipiscing().elit(); +} diff --git a/tests/source/configs-chain_one_line_max-below.rs b/tests/source/configs-chain_one_line_max-below.rs new file mode 100644 index 00000000000..e869c782d07 --- /dev/null +++ b/tests/source/configs-chain_one_line_max-below.rs @@ -0,0 +1,6 @@ +// rustfmt-chain_one_line_max: 100 +// Chain one line max + +fn main() { + let lorem = ipsum.dolor().sit().amet().consectetur().adipiscing().elit(); +} diff --git a/tests/source/configs-closure_block_indent_threshold-10.rs b/tests/source/configs-closure_block_indent_threshold-10.rs new file mode 100644 index 00000000000..21b47a8d7ca --- /dev/null +++ b/tests/source/configs-closure_block_indent_threshold-10.rs @@ -0,0 +1,12 @@ +// rustfmt-closure_block_indent_threshold: 10 +// Closure block indent threshold + +fn main() { + lorem_ipsum(|| { + println!("lorem"); + println!("ipsum"); + println!("dolor"); + println!("sit"); + println!("amet"); + }); +} diff --git a/tests/source/configs-closure_block_indent_threshold-2.rs b/tests/source/configs-closure_block_indent_threshold-2.rs new file mode 100644 index 00000000000..089ac3288ef --- /dev/null +++ b/tests/source/configs-closure_block_indent_threshold-2.rs @@ -0,0 +1,12 @@ +// rustfmt-closure_block_indent_threshold: 2 +// Closure block indent threshold + +fn main() { + lorem_ipsum(|| { + println!("lorem"); + println!("ipsum"); + println!("dolor"); + println!("sit"); + println!("amet"); + }); +} diff --git a/tests/source/configs-comment_width-above.rs b/tests/source/configs-comment_width-above.rs new file mode 100644 index 00000000000..36187ce0af4 --- /dev/null +++ b/tests/source/configs-comment_width-above.rs @@ -0,0 +1,7 @@ +// rustfmt-comment_width: 40 +// rustfmt-wrap_comments: true +// Comment width + +fn main() { + // Lorem ipsum dolor sit amet, consectetur adipiscing elit. +} diff --git a/tests/source/configs-comment_width-below.rs b/tests/source/configs-comment_width-below.rs new file mode 100644 index 00000000000..abbc5930c4c --- /dev/null +++ b/tests/source/configs-comment_width-below.rs @@ -0,0 +1,7 @@ +// rustfmt-comment_width: 80 +// rustfmt-wrap_comments: true +// Comment width + +fn main() { + // Lorem ipsum dolor sit amet, consectetur adipiscing elit. +} diff --git a/tests/source/configs-comment_width-ignore.rs b/tests/source/configs-comment_width-ignore.rs new file mode 100644 index 00000000000..c86e71c2898 --- /dev/null +++ b/tests/source/configs-comment_width-ignore.rs @@ -0,0 +1,7 @@ +// rustfmt-comment_width: 40 +// rustfmt-wrap_comments: false +// Comment width + +fn main() { + // Lorem ipsum dolor sit amet, consectetur adipiscing elit. +} diff --git a/tests/source/configs-condense_wildcard_suffices-false.rs b/tests/source/configs-condense_wildcard_suffices-false.rs new file mode 100644 index 00000000000..e4ad1f2f3cc --- /dev/null +++ b/tests/source/configs-condense_wildcard_suffices-false.rs @@ -0,0 +1,6 @@ +// rustfmt-condense_wildcard_suffices: false +// Condense wildcard suffices + +fn main() { + let (lorem, ipsum, _, _) = (1, 2, 3, 4); +} diff --git a/tests/source/configs-condense_wildcard_suffices-true.rs b/tests/source/configs-condense_wildcard_suffices-true.rs new file mode 100644 index 00000000000..2c8457a88d3 --- /dev/null +++ b/tests/source/configs-condense_wildcard_suffices-true.rs @@ -0,0 +1,6 @@ +// rustfmt-condense_wildcard_suffices: true +// Condense wildcard suffices + +fn main() { + let (lorem, ipsum, _, _) = (1, 2, 3, 4); +} diff --git a/tests/source/configs-control_brace_style-always_next_line.rs b/tests/source/configs-control_brace_style-always_next_line.rs new file mode 100644 index 00000000000..9cd0b2b7fbf --- /dev/null +++ b/tests/source/configs-control_brace_style-always_next_line.rs @@ -0,0 +1,6 @@ +// rustfmt-control_brace_style: AlwaysNextLine +// Control brace style + +fn main() { + if lorem { println!("ipsum!"); } else { println!("dolor!"); } +} diff --git a/tests/source/configs-control_brace_style-always_same_line.rs b/tests/source/configs-control_brace_style-always_same_line.rs new file mode 100644 index 00000000000..f88a102fc63 --- /dev/null +++ b/tests/source/configs-control_brace_style-always_same_line.rs @@ -0,0 +1,6 @@ +// rustfmt-control_brace_style: AlwaysSameLine +// Control brace style + +fn main() { + if lorem { println!("ipsum!"); } else { println!("dolor!"); } +} diff --git a/tests/source/configs-control_brace_style-closing_next_line.rs b/tests/source/configs-control_brace_style-closing_next_line.rs new file mode 100644 index 00000000000..b9410edba44 --- /dev/null +++ b/tests/source/configs-control_brace_style-closing_next_line.rs @@ -0,0 +1,6 @@ +// rustfmt-control_brace_style: ClosingNextLine +// Control brace style + +fn main() { + if lorem { println!("ipsum!"); } else { println!("dolor!"); } +} diff --git a/tests/source/configs-disable_all_formatting-false.rs b/tests/source/configs-disable_all_formatting-false.rs new file mode 100644 index 00000000000..834ca7a3c89 --- /dev/null +++ b/tests/source/configs-disable_all_formatting-false.rs @@ -0,0 +1,6 @@ +// rustfmt-disable_all_formatting: false +// Disable all formatting + +fn main() { + if lorem{println!("ipsum!");}else{println!("dolor!");} +} diff --git a/tests/source/configs-disable_all_formatting-true.rs b/tests/source/configs-disable_all_formatting-true.rs new file mode 100644 index 00000000000..56955bf384d --- /dev/null +++ b/tests/source/configs-disable_all_formatting-true.rs @@ -0,0 +1,6 @@ +// rustfmt-disable_all_formatting: true +// Disable all formatting + +fn main() { + iflorem{println!("ipsum!");}else{println!("dolor!");} +} diff --git a/tests/source/configs-error_on_line_overflow-false.rs b/tests/source/configs-error_on_line_overflow-false.rs new file mode 100644 index 00000000000..fa70ae78352 --- /dev/null +++ b/tests/source/configs-error_on_line_overflow-false.rs @@ -0,0 +1,6 @@ +// rustfmt-error_on_line_overflow: false +// Error on line overflow + +fn main() { + let lorem_ipsum_dolor_sit_amet_consectetur_adipiscing_elit_lorem_ipsum_dolor_sit_amet_consectetur_adipiscing_elit; +} diff --git a/tests/source/configs-fn_args_density-compressed.rs b/tests/source/configs-fn_args_density-compressed.rs new file mode 100644 index 00000000000..86c0b42e53c --- /dev/null +++ b/tests/source/configs-fn_args_density-compressed.rs @@ -0,0 +1,16 @@ +// rustfmt-fn_args_density: Compressed +// Function arguments density + +trait Lorem { + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet); + + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) { + // body + } + + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, adipiscing: Adipiscing, elit: Elit); + + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, adipiscing: Adipiscing, elit: Elit) { + // body + } +} diff --git a/tests/source/configs-fn_args_density-compressed_if_empty.rs b/tests/source/configs-fn_args_density-compressed_if_empty.rs new file mode 100644 index 00000000000..3506ae8ea5c --- /dev/null +++ b/tests/source/configs-fn_args_density-compressed_if_empty.rs @@ -0,0 +1,20 @@ +// rustfmt-fn_args_density: CompressedIfEmpty +// Function arguments density + +trait Lorem { + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet); + + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) { + // body + } + + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, adipiscing: Adipiscing, elit: Elit); + + // FIXME: Previous line should be formatted like this: + // fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, + // adipiscing: Adipiscing, elit: Elit); + + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, adipiscing: Adipiscing, elit: Elit) { + // body + } +} diff --git a/tests/source/configs-fn_args_density-tall.rs b/tests/source/configs-fn_args_density-tall.rs new file mode 100644 index 00000000000..fc400e1c113 --- /dev/null +++ b/tests/source/configs-fn_args_density-tall.rs @@ -0,0 +1,16 @@ +// rustfmt-fn_args_density: Tall +// Function arguments density + +trait Lorem { + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet); + + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) { + // body + } + + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, adipiscing: Adipiscing, elit: Elit); + + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, adipiscing: Adipiscing, elit: Elit) { + // body + } +} diff --git a/tests/source/configs-fn_args_density-vertical.rs b/tests/source/configs-fn_args_density-vertical.rs new file mode 100644 index 00000000000..20b1427d83d --- /dev/null +++ b/tests/source/configs-fn_args_density-vertical.rs @@ -0,0 +1,16 @@ +// rustfmt-fn_args_density: Vertical +// Function arguments density + +trait Lorem { + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet); + + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) { + // body + } + + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, adipiscing: Adipiscing, elit: Elit); + + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, adipiscing: Adipiscing, elit: Elit) { + // body + } +} diff --git a/tests/source/configs-fn_args_layout-block.rs b/tests/source/configs-fn_args_layout-block.rs new file mode 100644 index 00000000000..bb36e9d34c5 --- /dev/null +++ b/tests/source/configs-fn_args_layout-block.rs @@ -0,0 +1,10 @@ +// rustfmt-fn_args_layout: Block +// Function arguments layout + +fn lorem() {} + +fn lorem(ipsum: usize) {} + +fn lorem(ipsum: usize, dolor: usize, sit: usize, amet: usize, consectetur: usize, adipiscing: usize, elit: usize) { + // body +} diff --git a/tests/source/configs-fn_args_layout-visual.rs b/tests/source/configs-fn_args_layout-visual.rs new file mode 100644 index 00000000000..b0d88fb0651 --- /dev/null +++ b/tests/source/configs-fn_args_layout-visual.rs @@ -0,0 +1,10 @@ +// rustfmt-fn_args_layout: Visual +// Function arguments layout + +fn lorem() {} + +fn lorem(ipsum: usize) {} + +fn lorem(ipsum: usize, dolor: usize, sit: usize, amet: usize, consectetur: usize, adipiscing: usize, elit: usize) { + // body +} diff --git a/tests/source/configs-fn_args_paren_newline-false.rs b/tests/source/configs-fn_args_paren_newline-false.rs new file mode 100644 index 00000000000..edffeb14044 --- /dev/null +++ b/tests/source/configs-fn_args_paren_newline-false.rs @@ -0,0 +1,6 @@ +// rustfmt-fn_args_paren_newline: false +// Function arguments parenthesis on a newline + +fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) -> DolorSitAmetConsecteturAdipiscingElitLoremIpsumDolorSitAmetConsecteturAdipiscingElit { + // body +} diff --git a/tests/source/configs-fn_args_paren_newline-true.rs b/tests/source/configs-fn_args_paren_newline-true.rs new file mode 100644 index 00000000000..d60c510b6cf --- /dev/null +++ b/tests/source/configs-fn_args_paren_newline-true.rs @@ -0,0 +1,6 @@ +// rustfmt-fn_args_paren_newline: true +// Function arguments parenthesis on a newline + +fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) -> DolorSitAmetConsecteturAdipiscingElitLoremIpsumDolorSitAmetConsecteturAdipiscingElit { + // body +} diff --git a/tests/source/configs-fn_brace_style-always_next_line.rs b/tests/source/configs-fn_brace_style-always_next_line.rs new file mode 100644 index 00000000000..9e1a6048a5a --- /dev/null +++ b/tests/source/configs-fn_brace_style-always_next_line.rs @@ -0,0 +1,14 @@ +// rustfmt-fn_brace_style: AlwaysNextLine +// Function brace style + +fn lorem() { + // body +} + +fn lorem(ipsum: usize) { + // body +} + +fn lorem(ipsum: T) where T: Add + Sub + Mul + Div { + // body +} diff --git a/tests/source/configs-fn_brace_style-prefer_same_line.rs b/tests/source/configs-fn_brace_style-prefer_same_line.rs new file mode 100644 index 00000000000..2bca0f44618 --- /dev/null +++ b/tests/source/configs-fn_brace_style-prefer_same_line.rs @@ -0,0 +1,14 @@ +// rustfmt-fn_brace_style: PreferSameLine +// Function brace style + +fn lorem() { + // body +} + +fn lorem(ipsum: usize) { + // body +} + +fn lorem(ipsum: T) where T: Add + Sub + Mul + Div { + // body +} diff --git a/tests/source/configs-fn_brace_style-same_line_where.rs b/tests/source/configs-fn_brace_style-same_line_where.rs new file mode 100644 index 00000000000..7213634fdc4 --- /dev/null +++ b/tests/source/configs-fn_brace_style-same_line_where.rs @@ -0,0 +1,14 @@ +// rustfmt-fn_brace_style: SameLineWhere +// Function brace style + +fn lorem() { + // body +} + +fn lorem(ipsum: usize) { + // body +} + +fn lorem(ipsum: T) where T: Add + Sub + Mul + Div { + // body +} diff --git a/tests/source/configs-fn_call_style-block.rs b/tests/source/configs-fn_call_style-block.rs new file mode 100644 index 00000000000..50d00540515 --- /dev/null +++ b/tests/source/configs-fn_call_style-block.rs @@ -0,0 +1,6 @@ +// rustfmt-fn_call_style: Block +// Function call style + +fn main() { + lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit"); +} diff --git a/tests/source/configs-fn_call_style-visual.rs b/tests/source/configs-fn_call_style-visual.rs new file mode 100644 index 00000000000..1cb48cfadd6 --- /dev/null +++ b/tests/source/configs-fn_call_style-visual.rs @@ -0,0 +1,6 @@ +// rustfmt-fn_call_style: Visual +// Function call style + +fn main() { + lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit"); +} diff --git a/tests/source/configs-fn_call_width-above.rs b/tests/source/configs-fn_call_width-above.rs new file mode 100644 index 00000000000..237e72c3034 --- /dev/null +++ b/tests/source/configs-fn_call_width-above.rs @@ -0,0 +1,6 @@ +// rustfmt-fn_call_width: 10 +// Function call width + +fn main() { + lorem("lorem", "ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit"); +} diff --git a/tests/source/configs-fn_call_width-below.rs b/tests/source/configs-fn_call_width-below.rs new file mode 100644 index 00000000000..b79918f5b98 --- /dev/null +++ b/tests/source/configs-fn_call_width-below.rs @@ -0,0 +1,6 @@ +// rustfmt-fn_call_width: 100 +// Function call width + +fn main() { + lorem("lorem", "ipsum", "dolor"); +} diff --git a/tests/source/configs-fn_empty_single_line-false.rs b/tests/source/configs-fn_empty_single_line-false.rs new file mode 100644 index 00000000000..86a279b5869 --- /dev/null +++ b/tests/source/configs-fn_empty_single_line-false.rs @@ -0,0 +1,9 @@ +// rustfmt-fn_empty_single_line: false +// Empty function on single line + +fn lorem() { +} + +fn lorem() { + +} diff --git a/tests/source/configs-fn_empty_single_line-true.rs b/tests/source/configs-fn_empty_single_line-true.rs new file mode 100644 index 00000000000..2603efd0754 --- /dev/null +++ b/tests/source/configs-fn_empty_single_line-true.rs @@ -0,0 +1,9 @@ +// rustfmt-fn_empty_single_line: true +// Empty function on single line + +fn lorem() { +} + +fn lorem() { + +} diff --git a/tests/source/configs-fn_return_indent-with_args.rs b/tests/source/configs-fn_return_indent-with_args.rs new file mode 100644 index 00000000000..35d1459641a --- /dev/null +++ b/tests/source/configs-fn_return_indent-with_args.rs @@ -0,0 +1,6 @@ +// rustfmt-fn_return_indent: WithArgs +// Function return type indent + +fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur, adipiscing: Adipiscing) -> Elit where Ipsum: Eq { + // body +} diff --git a/tests/source/configs-fn_return_indent-with_where_clause.rs b/tests/source/configs-fn_return_indent-with_where_clause.rs new file mode 100644 index 00000000000..2fdbcd26572 --- /dev/null +++ b/tests/source/configs-fn_return_indent-with_where_clause.rs @@ -0,0 +1,6 @@ +// rustfmt-fn_return_indent: WithWhereClause +// Function return type indent + +fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: Consectetur, adipiscing: Adipiscing) -> Elit where Ipsum: Eq { + // body +} diff --git a/tests/source/configs-fn_single_line-false.rs b/tests/source/configs-fn_single_line-false.rs new file mode 100644 index 00000000000..3d092f0c0bf --- /dev/null +++ b/tests/source/configs-fn_single_line-false.rs @@ -0,0 +1,11 @@ +// rustfmt-fn_single_line: false +// Single-expression function on single line + +fn lorem() -> usize { + 42 +} + +fn lorem() -> usize { + let ipsum = 42; + ipsum +} diff --git a/tests/source/configs-fn_single_line-true.rs b/tests/source/configs-fn_single_line-true.rs new file mode 100644 index 00000000000..3cb0fdedf0b --- /dev/null +++ b/tests/source/configs-fn_single_line-true.rs @@ -0,0 +1,11 @@ +// rustfmt-fn_single_line: true +// Single-expression function on single line + +fn lorem() -> usize { + 42 +} + +fn lorem() -> usize { + let ipsum = 42; + ipsum +} diff --git a/tests/source/configs-force_explicit_abi-false.rs b/tests/source/configs-force_explicit_abi-false.rs new file mode 100644 index 00000000000..3c48f8e0c78 --- /dev/null +++ b/tests/source/configs-force_explicit_abi-false.rs @@ -0,0 +1,6 @@ +// rustfmt-force_explicit_abi: false +// Force explicit abi + +extern { + pub static lorem: c_int; +} diff --git a/tests/source/configs-force_explicit_abi-true.rs b/tests/source/configs-force_explicit_abi-true.rs new file mode 100644 index 00000000000..e5ff6cf7dd7 --- /dev/null +++ b/tests/source/configs-force_explicit_abi-true.rs @@ -0,0 +1,6 @@ +// rustfmt-force_explicit_abi: true +// Force explicit abi + +extern { + pub static lorem: c_int; +} diff --git a/tests/source/configs-force_format_strings-false.rs b/tests/source/configs-force_format_strings-false.rs new file mode 100644 index 00000000000..49f32c557b3 --- /dev/null +++ b/tests/source/configs-force_format_strings-false.rs @@ -0,0 +1,9 @@ +// rustfmt-force_format_strings: false +// rustfmt-format_strings: false +// rustfmt-max_width: 50 +// rustfmt-error_on_line_overflow: false +// Force format strings + +fn main() { + let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit"; +} diff --git a/tests/source/configs-force_format_strings-true.rs b/tests/source/configs-force_format_strings-true.rs new file mode 100644 index 00000000000..7a87bed4d15 --- /dev/null +++ b/tests/source/configs-force_format_strings-true.rs @@ -0,0 +1,8 @@ +// rustfmt-force_format_strings: true +// rustfmt-format_strings: false +// rustfmt-max_width: 50 +// Force format strings + +fn main() { + let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit"; +} diff --git a/tests/source/configs-format_strings-false.rs b/tests/source/configs-format_strings-false.rs new file mode 100644 index 00000000000..ecca0d7d1fc --- /dev/null +++ b/tests/source/configs-format_strings-false.rs @@ -0,0 +1,8 @@ +// rustfmt-format_strings: false +// rustfmt-max_width: 50 +// rustfmt-error_on_line_overflow: false +// Force format strings + +fn main() { + let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit"; +} diff --git a/tests/source/configs-format_strings-true.rs b/tests/source/configs-format_strings-true.rs new file mode 100644 index 00000000000..33731447821 --- /dev/null +++ b/tests/source/configs-format_strings-true.rs @@ -0,0 +1,7 @@ +// rustfmt-format_strings: true +// rustfmt-max_width: 50 +// Force format strings + +fn main() { + let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit"; +} diff --git a/tests/source/configs-generics_indent-block.rs b/tests/source/configs-generics_indent-block.rs new file mode 100644 index 00000000000..9bfde87e88b --- /dev/null +++ b/tests/source/configs-generics_indent-block.rs @@ -0,0 +1,6 @@ +// rustfmt-generics_indent: Block +// Generics indent + +fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, adipiscing: Adipiscing, consectetur: Consectetur, elit: Elit) -> T { + // body +} diff --git a/tests/source/configs-generics_indent-visual.rs b/tests/source/configs-generics_indent-visual.rs new file mode 100644 index 00000000000..3129dc1c3c7 --- /dev/null +++ b/tests/source/configs-generics_indent-visual.rs @@ -0,0 +1,6 @@ +// rustfmt-generics_indent: Visual +// Generics indent + +fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, adipiscing: Adipiscing, consectetur: Consectetur, elit: Elit) -> T { + // body +} diff --git a/tests/source/configs-hard_tabs-false.rs b/tests/source/configs-hard_tabs-false.rs new file mode 100644 index 00000000000..bf92162b424 --- /dev/null +++ b/tests/source/configs-hard_tabs-false.rs @@ -0,0 +1,6 @@ +// rustfmt-hard_tabs: false +// Hard tabs + +fn lorem() -> usize { +42 // spaces before 42 +} diff --git a/tests/source/configs-hard_tabs-true.rs b/tests/source/configs-hard_tabs-true.rs new file mode 100644 index 00000000000..738922a4dfb --- /dev/null +++ b/tests/source/configs-hard_tabs-true.rs @@ -0,0 +1,6 @@ +// rustfmt-hard_tabs: true +// Hard tabs + +fn lorem() -> usize { +42 // spaces before 42 +} diff --git a/tests/source/configs-impl_empty_single_line-false.rs b/tests/source/configs-impl_empty_single_line-false.rs new file mode 100644 index 00000000000..bdd114e544a --- /dev/null +++ b/tests/source/configs-impl_empty_single_line-false.rs @@ -0,0 +1,10 @@ +// rustfmt-impl_empty_single_line: false +// Empty impl on single line + +impl Lorem { + +} + +impl Ipsum { + +} diff --git a/tests/source/configs-impl_empty_single_line-true.rs b/tests/source/configs-impl_empty_single_line-true.rs new file mode 100644 index 00000000000..3b1f84f5cd0 --- /dev/null +++ b/tests/source/configs-impl_empty_single_line-true.rs @@ -0,0 +1,10 @@ +// rustfmt-impl_empty_single_line: true +// Empty impl on single line + +impl Lorem { + +} + +impl Ipsum { + +} diff --git a/tests/source/configs-indent_match_arms-false.rs b/tests/source/configs-indent_match_arms-false.rs new file mode 100644 index 00000000000..3bd9fc4dd7d --- /dev/null +++ b/tests/source/configs-indent_match_arms-false.rs @@ -0,0 +1,8 @@ +// rustfmt-indent_match_arms: false +// Indent match arms + +fn main() { + match lorem { + Lorem::Ipsum => (), Lorem::Dolor => (), Lorem::Sit => (), Lorem::Amet => (), + } +} diff --git a/tests/source/configs-indent_match_arms-true.rs b/tests/source/configs-indent_match_arms-true.rs new file mode 100644 index 00000000000..aa657980806 --- /dev/null +++ b/tests/source/configs-indent_match_arms-true.rs @@ -0,0 +1,8 @@ +// rustfmt-indent_match_arms: true +// Indent match arms + +fn main() { + match lorem { + Lorem::Ipsum => (), Lorem::Dolor => (), Lorem::Sit => (), Lorem::Amet => (), + } +} diff --git a/tests/source/configs-item_brace_style-always_next_line.rs b/tests/source/configs-item_brace_style-always_next_line.rs new file mode 100644 index 00000000000..f60977d015c --- /dev/null +++ b/tests/source/configs-item_brace_style-always_next_line.rs @@ -0,0 +1,10 @@ +// rustfmt-item_brace_style: AlwaysNextLine +// Item brace style + +struct Lorem { + ipsum: bool, +} + +struct Dolor where T: Eq { + sit: T, +} diff --git a/tests/source/configs-item_brace_style-prefer_same_line.rs b/tests/source/configs-item_brace_style-prefer_same_line.rs new file mode 100644 index 00000000000..81438f1194f --- /dev/null +++ b/tests/source/configs-item_brace_style-prefer_same_line.rs @@ -0,0 +1,10 @@ +// rustfmt-item_brace_style: PreferSameLine +// Item brace style + +struct Lorem { + ipsum: bool, +} + +struct Dolor where T: Eq { + sit: T, +} diff --git a/tests/source/configs-item_brace_style-same_line_where.rs b/tests/source/configs-item_brace_style-same_line_where.rs new file mode 100644 index 00000000000..4dc4439c176 --- /dev/null +++ b/tests/source/configs-item_brace_style-same_line_where.rs @@ -0,0 +1,10 @@ +// rustfmt-item_brace_style: SameLineWhere +// Item brace style + +struct Lorem { + ipsum: bool, +} + +struct Dolor where T: Eq { + sit: T, +} diff --git a/tests/source/configs-match_block_trailing_comma-false.rs b/tests/source/configs-match_block_trailing_comma-false.rs new file mode 100644 index 00000000000..70e02955fb0 --- /dev/null +++ b/tests/source/configs-match_block_trailing_comma-false.rs @@ -0,0 +1,11 @@ +// rustfmt-match_block_trailing_comma: false +// Match block trailing comma + +fn main() { + match lorem { + Lorem::Ipsum => { + println!("ipsum"); + } + Lorem::Dolor => println!("dolor"), + } +} diff --git a/tests/source/configs-match_block_trailing_comma-true.rs b/tests/source/configs-match_block_trailing_comma-true.rs new file mode 100644 index 00000000000..b9af3d47202 --- /dev/null +++ b/tests/source/configs-match_block_trailing_comma-true.rs @@ -0,0 +1,11 @@ +// rustfmt-match_block_trailing_comma: true +// Match block trailing comma + +fn main() { + match lorem { + Lorem::Ipsum => { + println!("ipsum"); + } + Lorem::Dolor => println!("dolor"), + } +} diff --git a/tests/source/configs-normalize_comments-false.rs b/tests/source/configs-normalize_comments-false.rs new file mode 100644 index 00000000000..6bb214330a1 --- /dev/null +++ b/tests/source/configs-normalize_comments-false.rs @@ -0,0 +1,8 @@ +// rustfmt-normalize_comments: false +// Normalize comments + +// Lorem ipsum: +fn dolor() -> usize {} + +/* sit amet: */ +fn adipiscing() -> usize {} diff --git a/tests/source/configs-normalize_comments-true.rs b/tests/source/configs-normalize_comments-true.rs new file mode 100644 index 00000000000..3be75db88c2 --- /dev/null +++ b/tests/source/configs-normalize_comments-true.rs @@ -0,0 +1,8 @@ +// rustfmt-normalize_comments: true +// Normalize comments + +// Lorem ipsum: +fn dolor() -> usize {} + +/* sit amet: */ +fn adipiscing() -> usize {} diff --git a/tests/source/configs-reorder_imported_names-false.rs b/tests/source/configs-reorder_imported_names-false.rs new file mode 100644 index 00000000000..91db89ceeaa --- /dev/null +++ b/tests/source/configs-reorder_imported_names-false.rs @@ -0,0 +1,4 @@ +// rustfmt-reorder_imported_names: false +// Reorder imported names + +use super::{lorem, ipsum, dolor, sit}; diff --git a/tests/source/configs-reorder_imported_names-true.rs b/tests/source/configs-reorder_imported_names-true.rs new file mode 100644 index 00000000000..69da6186d5a --- /dev/null +++ b/tests/source/configs-reorder_imported_names-true.rs @@ -0,0 +1,4 @@ +// rustfmt-reorder_imported_names: true +// Reorder imported names + +use super::{lorem, ipsum, dolor, sit}; diff --git a/tests/source/configs-reorder_imports-false.rs b/tests/source/configs-reorder_imports-false.rs new file mode 100644 index 00000000000..4b85684dc01 --- /dev/null +++ b/tests/source/configs-reorder_imports-false.rs @@ -0,0 +1,7 @@ +// rustfmt-reorder_imports: false +// Reorder imports + +use lorem; +use ipsum; +use dolor; +use sit; diff --git a/tests/source/configs-reorder_imports-true.rs b/tests/source/configs-reorder_imports-true.rs new file mode 100644 index 00000000000..5147f0c9bf3 --- /dev/null +++ b/tests/source/configs-reorder_imports-true.rs @@ -0,0 +1,7 @@ +// rustfmt-reorder_imports: true +// Reorder imports + +use lorem; +use ipsum; +use dolor; +use sit; diff --git a/tests/source/configs-single_line_if_else_max_width-above.rs b/tests/source/configs-single_line_if_else_max_width-above.rs new file mode 100644 index 00000000000..698fa8bc460 --- /dev/null +++ b/tests/source/configs-single_line_if_else_max_width-above.rs @@ -0,0 +1,6 @@ +// rustfmt-single_line_if_else_max_width: 10 +// Single line if-else max width + +fn main() { + let lorem = if ipsum { dolor } else { sit }; +} diff --git a/tests/source/configs-single_line_if_else_max_width-below.rs b/tests/source/configs-single_line_if_else_max_width-below.rs new file mode 100644 index 00000000000..efafa6c4498 --- /dev/null +++ b/tests/source/configs-single_line_if_else_max_width-below.rs @@ -0,0 +1,6 @@ +// rustfmt-single_line_if_else_max_width: 100 +// Single line if-else max width + +fn main() { + let lorem = if ipsum { dolor } else { sit }; +} diff --git a/tests/source/configs-space_after_bound_colon-false.rs b/tests/source/configs-space_after_bound_colon-false.rs new file mode 100644 index 00000000000..129d51048cc --- /dev/null +++ b/tests/source/configs-space_after_bound_colon-false.rs @@ -0,0 +1,6 @@ +// rustfmt-space_after_bound_colon: false +// Space after bound colon + +fn lorem(t:T) { + // body +} diff --git a/tests/source/configs-space_after_bound_colon-true.rs b/tests/source/configs-space_after_bound_colon-true.rs new file mode 100644 index 00000000000..32ebd52b102 --- /dev/null +++ b/tests/source/configs-space_after_bound_colon-true.rs @@ -0,0 +1,6 @@ +// rustfmt-space_after_bound_colon: true +// Space after bound colon + +fn lorem(t:T) { + // body +} diff --git a/tests/source/configs-space_after_type_annotation_colon-false.rs b/tests/source/configs-space_after_type_annotation_colon-false.rs new file mode 100644 index 00000000000..f814593a94e --- /dev/null +++ b/tests/source/configs-space_after_type_annotation_colon-false.rs @@ -0,0 +1,6 @@ +// rustfmt-space_after_type_annotation_colon: false +// Space after type annotation colon + +fn lorem(t:T) { + let ipsum:Dolor = sit; +} diff --git a/tests/source/configs-space_after_type_annotation_colon-true.rs b/tests/source/configs-space_after_type_annotation_colon-true.rs new file mode 100644 index 00000000000..1a86a5879bd --- /dev/null +++ b/tests/source/configs-space_after_type_annotation_colon-true.rs @@ -0,0 +1,6 @@ +// rustfmt-space_after_type_annotation_colon: true +// Space after type annotation colon + +fn lorem(t:T) { + let ipsum:Dolor = sit; +} diff --git a/tests/source/configs-space_before_bound-false.rs b/tests/source/configs-space_before_bound-false.rs new file mode 100644 index 00000000000..f6168281c4f --- /dev/null +++ b/tests/source/configs-space_before_bound-false.rs @@ -0,0 +1,6 @@ +// rustfmt-space_before_bound: false +// Space before bound + +fn lorem(t:T) { + let ipsum:Dolor = sit; +} diff --git a/tests/source/configs-space_before_bound-true.rs b/tests/source/configs-space_before_bound-true.rs new file mode 100644 index 00000000000..7a16b5dbca3 --- /dev/null +++ b/tests/source/configs-space_before_bound-true.rs @@ -0,0 +1,6 @@ +// rustfmt-space_before_bound: true +// Space before bound + +fn lorem(t:T) { + let ipsum:Dolor = sit; +} diff --git a/tests/source/configs-space_before_type_annotation-false.rs b/tests/source/configs-space_before_type_annotation-false.rs new file mode 100644 index 00000000000..817aa5c5940 --- /dev/null +++ b/tests/source/configs-space_before_type_annotation-false.rs @@ -0,0 +1,6 @@ +// rustfmt-space_before_type_annotation: false +// Space before type-annotation + +fn lorem(t:T) { + let ipsum:Dolor = sit; +} diff --git a/tests/source/configs-space_before_type_annotation-true.rs b/tests/source/configs-space_before_type_annotation-true.rs new file mode 100644 index 00000000000..4df9ad341e6 --- /dev/null +++ b/tests/source/configs-space_before_type_annotation-true.rs @@ -0,0 +1,6 @@ +// rustfmt-space_before_type_annotation: true +// Space before type-annotation + +fn lorem(t:T) { + let ipsum:Dolor = sit; +} diff --git a/tests/source/configs-spaces_around_ranges-false.rs b/tests/source/configs-spaces_around_ranges-false.rs new file mode 100644 index 00000000000..3d431e4d1ce --- /dev/null +++ b/tests/source/configs-spaces_around_ranges-false.rs @@ -0,0 +1,6 @@ +// rustfmt-spaces_around_ranges: false +// Spaces around ranges + +fn main() { + let lorem = 0..10; +} diff --git a/tests/source/configs-spaces_around_ranges-true.rs b/tests/source/configs-spaces_around_ranges-true.rs new file mode 100644 index 00000000000..8e9a311abf3 --- /dev/null +++ b/tests/source/configs-spaces_around_ranges-true.rs @@ -0,0 +1,6 @@ +// rustfmt-spaces_around_ranges: true +// Spaces around ranges + +fn main() { + let lorem = 0..10; +} diff --git a/tests/source/configs-spaces_within_angle_brackets-false.rs b/tests/source/configs-spaces_within_angle_brackets-false.rs new file mode 100644 index 00000000000..3823216f433 --- /dev/null +++ b/tests/source/configs-spaces_within_angle_brackets-false.rs @@ -0,0 +1,6 @@ +// rustfmt-spaces_within_angle_brackets: false +// Spaces within angle-brackets + +fn lorem(t: T) { + // body +} diff --git a/tests/source/configs-spaces_within_angle_brackets-true.rs b/tests/source/configs-spaces_within_angle_brackets-true.rs new file mode 100644 index 00000000000..f2b97d7def3 --- /dev/null +++ b/tests/source/configs-spaces_within_angle_brackets-true.rs @@ -0,0 +1,6 @@ +// rustfmt-spaces_within_angle_brackets: true +// Spaces within angle-brackets + +fn lorem(t: T) { + // body +} diff --git a/tests/source/configs-spaces_within_parens-false.rs b/tests/source/configs-spaces_within_parens-false.rs new file mode 100644 index 00000000000..05c25584fe1 --- /dev/null +++ b/tests/source/configs-spaces_within_parens-false.rs @@ -0,0 +1,6 @@ +// rustfmt-spaces_within_parens: false +// Spaces within parens + +fn lorem(t: T) { + let lorem = (ipsum, dolor); +} diff --git a/tests/source/configs-spaces_within_parens-true.rs b/tests/source/configs-spaces_within_parens-true.rs new file mode 100644 index 00000000000..7f041d71f49 --- /dev/null +++ b/tests/source/configs-spaces_within_parens-true.rs @@ -0,0 +1,6 @@ +// rustfmt-spaces_within_parens: true +// Spaces within parens + +fn lorem(t: T) { + let lorem = (ipsum, dolor); +} diff --git a/tests/source/configs-spaces_within_square_brackets-false.rs b/tests/source/configs-spaces_within_square_brackets-false.rs new file mode 100644 index 00000000000..6410646aad6 --- /dev/null +++ b/tests/source/configs-spaces_within_square_brackets-false.rs @@ -0,0 +1,6 @@ +// rustfmt-spaces_within_square_brackets: false +// Spaces within square-brackets + +fn main() { + let lorem: [usize; 2] = [ipsum, dolor]; +} diff --git a/tests/source/configs-spaces_within_square_brackets-true.rs b/tests/source/configs-spaces_within_square_brackets-true.rs new file mode 100644 index 00000000000..8683fb5f1c6 --- /dev/null +++ b/tests/source/configs-spaces_within_square_brackets-true.rs @@ -0,0 +1,6 @@ +// rustfmt-spaces_within_square_brackets: true +// Spaces within square-brackets + +fn main() { + let lorem: [usize; 2] = [ipsum, dolor]; +} diff --git a/tests/source/configs-struct_lit_multiline_style-force_multi.rs b/tests/source/configs-struct_lit_multiline_style-force_multi.rs new file mode 100644 index 00000000000..42e1b088bd1 --- /dev/null +++ b/tests/source/configs-struct_lit_multiline_style-force_multi.rs @@ -0,0 +1,6 @@ +// rustfmt-struct_lit_multiline_style: ForceMulti +// Struct literal multiline-style + +fn main() { + let lorem = Lorem { ipsum: dolor, sit: amet }; +} diff --git a/tests/source/configs-struct_lit_multiline_style-prefer_single.rs b/tests/source/configs-struct_lit_multiline_style-prefer_single.rs new file mode 100644 index 00000000000..9a4ac481335 --- /dev/null +++ b/tests/source/configs-struct_lit_multiline_style-prefer_single.rs @@ -0,0 +1,7 @@ +// rustfmt-struct_lit_multiline_style: PreferSingle +// rustfmt-struct_lit_width: 100 +// Struct literal multiline-style + +fn main() { + let lorem = Lorem { ipsum: dolor, sit: amet }; +} diff --git a/tests/source/configs-struct_lit_style-block.rs b/tests/source/configs-struct_lit_style-block.rs new file mode 100644 index 00000000000..69caa81ba09 --- /dev/null +++ b/tests/source/configs-struct_lit_style-block.rs @@ -0,0 +1,6 @@ +// rustfmt-struct_lit_style: Block +// Struct literal-style + +fn main() { + let lorem = Lorem { ipsum: dolor, sit: amet }; +} diff --git a/tests/source/configs-struct_lit_style-visual.rs b/tests/source/configs-struct_lit_style-visual.rs new file mode 100644 index 00000000000..1e461b3d64a --- /dev/null +++ b/tests/source/configs-struct_lit_style-visual.rs @@ -0,0 +1,6 @@ +// rustfmt-struct_lit_style: Visual +// Struct literal-style + +fn main() { + let lorem = Lorem { ipsum: dolor, sit: amet }; +} diff --git a/tests/source/configs-struct_lit_width-above.rs b/tests/source/configs-struct_lit_width-above.rs new file mode 100644 index 00000000000..123fa59f90e --- /dev/null +++ b/tests/source/configs-struct_lit_width-above.rs @@ -0,0 +1,6 @@ +// rustfmt-struct_lit_width: 10 +// Struct literal-style + +fn main() { + let lorem = Lorem { ipsum: dolor, sit: amet }; +} diff --git a/tests/source/configs-struct_lit_width-below.rs b/tests/source/configs-struct_lit_width-below.rs new file mode 100644 index 00000000000..7ffe4a32eaf --- /dev/null +++ b/tests/source/configs-struct_lit_width-below.rs @@ -0,0 +1,6 @@ +// rustfmt-struct_lit_width: 100 +// Struct literal-style + +fn main() { + let lorem = Lorem { ipsum: dolor, sit: amet }; +} diff --git a/tests/source/configs-struct_variant_width-above.rs b/tests/source/configs-struct_variant_width-above.rs new file mode 100644 index 00000000000..13ceed0bc63 --- /dev/null +++ b/tests/source/configs-struct_variant_width-above.rs @@ -0,0 +1,8 @@ +// rustfmt-struct_variant_width: 10 +// Struct variant width + +enum Lorem { + Ipsum, + Dolor(bool), + Sit { amet: Consectetur, adipiscing: Elit, }, +} diff --git a/tests/source/configs-struct_variant_width-below.rs b/tests/source/configs-struct_variant_width-below.rs new file mode 100644 index 00000000000..a16a57e19b8 --- /dev/null +++ b/tests/source/configs-struct_variant_width-below.rs @@ -0,0 +1,8 @@ +// rustfmt-struct_variant_width: 100 +// Struct variant width + +enum Lorem { + Ipsum, + Dolor(bool), + Sit { amet: Consectetur, adipiscing: Elit }, +} diff --git a/tests/source/configs-tab_spaces-2.rs b/tests/source/configs-tab_spaces-2.rs new file mode 100644 index 00000000000..5caf51bf234 --- /dev/null +++ b/tests/source/configs-tab_spaces-2.rs @@ -0,0 +1,11 @@ +// rustfmt-tab_spaces: 2 +// rustfmt-max_width: 30 +// rustfmt-array_layout: Block +// Tab spaces + +fn lorem() { +let ipsum = dolor(); +let sit = vec![ +"amet", "consectetur", "adipiscing", "elit." +]; +} diff --git a/tests/source/configs-tab_spaces-4.rs b/tests/source/configs-tab_spaces-4.rs new file mode 100644 index 00000000000..470849e769b --- /dev/null +++ b/tests/source/configs-tab_spaces-4.rs @@ -0,0 +1,11 @@ +// rustfmt-tab_spaces: 4 +// rustfmt-max_width: 30 +// rustfmt-array_layout: Block +// Tab spaces + +fn lorem() { +let ipsum = dolor(); +let sit = vec![ +"amet", "consectetur", "adipiscing", "elit." +]; +} diff --git a/tests/source/configs-trailing_comma-always.rs b/tests/source/configs-trailing_comma-always.rs new file mode 100644 index 00000000000..57e874cd822 --- /dev/null +++ b/tests/source/configs-trailing_comma-always.rs @@ -0,0 +1,7 @@ +// rustfmt-trailing_comma: Always +// Trailing comma + +fn main() { + let Lorem { ipsum, dolor, sit, } = amet; + let Lorem { ipsum, dolor, sit, amet, consectetur, adipiscing } = elit; +} diff --git a/tests/source/configs-trailing_comma-never.rs b/tests/source/configs-trailing_comma-never.rs new file mode 100644 index 00000000000..5d4dbef385a --- /dev/null +++ b/tests/source/configs-trailing_comma-never.rs @@ -0,0 +1,7 @@ +// rustfmt-trailing_comma: Never +// Trailing comma + +fn main() { + let Lorem { ipsum, dolor, sit, } = amet; + let Lorem { ipsum, dolor, sit, amet, consectetur, adipiscing } = elit; +} diff --git a/tests/source/configs-trailing_comma-vertical.rs b/tests/source/configs-trailing_comma-vertical.rs new file mode 100644 index 00000000000..c903e822158 --- /dev/null +++ b/tests/source/configs-trailing_comma-vertical.rs @@ -0,0 +1,7 @@ +// rustfmt-trailing_comma: Vertical +// Trailing comma + +fn main() { + let Lorem { ipsum, dolor, sit, } = amet; + let Lorem { ipsum, dolor, sit, amet, consectetur, adipiscing } = elit; +} diff --git a/tests/source/configs-type_punctuation_density-compressed.rs b/tests/source/configs-type_punctuation_density-compressed.rs new file mode 100644 index 00000000000..9cfb04658d5 --- /dev/null +++ b/tests/source/configs-type_punctuation_density-compressed.rs @@ -0,0 +1,7 @@ +// rustfmt-type_punctuation_density: Compressed +// Type punctuation density + +// FIXME: remove whitespace around `+`: +fn lorem() { + // body +} diff --git a/tests/source/configs-type_punctuation_density-wide.rs b/tests/source/configs-type_punctuation_density-wide.rs new file mode 100644 index 00000000000..1fcdddf0f9a --- /dev/null +++ b/tests/source/configs-type_punctuation_density-wide.rs @@ -0,0 +1,6 @@ +// rustfmt-type_punctuation_density: Wide +// Type punctuation density + +fn lorem() { + // body +} diff --git a/tests/source/configs-use_try_shorthand-false.rs b/tests/source/configs-use_try_shorthand-false.rs new file mode 100644 index 00000000000..de7f8b4a5e2 --- /dev/null +++ b/tests/source/configs-use_try_shorthand-false.rs @@ -0,0 +1,6 @@ +// rustfmt-use_try_shorthand: false +// Use try! shorthand + +fn main() { + let lorem = try!(ipsum.map(|dolor| dolor.sit())); +} diff --git a/tests/source/configs-use_try_shorthand-true.rs b/tests/source/configs-use_try_shorthand-true.rs new file mode 100644 index 00000000000..9015ec41e5e --- /dev/null +++ b/tests/source/configs-use_try_shorthand-true.rs @@ -0,0 +1,6 @@ +// rustfmt-use_try_shorthand: true +// Use try! shorthand + +fn main() { + let lorem = try!(ipsum.map(|dolor| dolor.sit())); +} diff --git a/tests/source/configs-where_density-compressed.rs b/tests/source/configs-where_density-compressed.rs new file mode 100644 index 00000000000..d10c860db07 --- /dev/null +++ b/tests/source/configs-where_density-compressed.rs @@ -0,0 +1,10 @@ +// rustfmt-where_density: Compressed +// Where density + +trait Lorem { + fn ipsum(dolor: Dolor) -> Sit where Dolor: Eq; + + fn ipsum(dolor: Dolor) -> Sit where Dolor: Eq { + // body + } +} diff --git a/tests/source/configs-where_density-compressed_if_empty.rs b/tests/source/configs-where_density-compressed_if_empty.rs new file mode 100644 index 00000000000..1d234a417d2 --- /dev/null +++ b/tests/source/configs-where_density-compressed_if_empty.rs @@ -0,0 +1,10 @@ +// rustfmt-where_density: CompressedIfEmpty +// Where density + +trait Lorem { + fn ipsum(dolor: Dolor) -> Sit where Dolor: Eq; + + fn ipsum(dolor: Dolor) -> Sit where Dolor: Eq { + // body + } +} diff --git a/tests/source/configs-where_density-tall.rs b/tests/source/configs-where_density-tall.rs new file mode 100644 index 00000000000..bf404715ec9 --- /dev/null +++ b/tests/source/configs-where_density-tall.rs @@ -0,0 +1,10 @@ +// rustfmt-where_density: Tall +// Where density + +trait Lorem { + fn ipsum(dolor: Dolor) -> Sit where Dolor: Eq; + + fn ipsum(dolor: Dolor) -> Sit where Dolor: Eq { + // body + } +} diff --git a/tests/source/configs-where_density-vertical.rs b/tests/source/configs-where_density-vertical.rs new file mode 100644 index 00000000000..dd4e1da9618 --- /dev/null +++ b/tests/source/configs-where_density-vertical.rs @@ -0,0 +1,10 @@ +// rustfmt-where_density: Vertical +// Where density + +trait Lorem { + fn ipsum(dolor: Dolor) -> Sit where Dolor: Eq; + + fn ipsum(dolor: Dolor) -> Sit where Dolor: Eq { + // body + } +} diff --git a/tests/source/configs-where_layout-horizontal.rs b/tests/source/configs-where_layout-horizontal.rs new file mode 100644 index 00000000000..0d676b74d7b --- /dev/null +++ b/tests/source/configs-where_layout-horizontal.rs @@ -0,0 +1,11 @@ +// rustfmt-where_layout: Horizontal +// rustfmt-error_on_line_overflow: false +// Where layout + +fn lorem(ipsum: Ipsum, dolor: Dolor) where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur { + // body +} + +fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur, Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit { + // body +} diff --git a/tests/source/configs-where_layout-horizontal_vertical.rs b/tests/source/configs-where_layout-horizontal_vertical.rs new file mode 100644 index 00000000000..dd389dbfd39 --- /dev/null +++ b/tests/source/configs-where_layout-horizontal_vertical.rs @@ -0,0 +1,10 @@ +// rustfmt-where_layout: HorizontalVertical +// Where layout + +fn lorem(ipsum: Ipsum, dolor: Dolor) where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur { + // body +} + +fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur, Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit { + // body +} diff --git a/tests/source/configs-where_layout-mixed.rs b/tests/source/configs-where_layout-mixed.rs new file mode 100644 index 00000000000..c3b78b2cd2e --- /dev/null +++ b/tests/source/configs-where_layout-mixed.rs @@ -0,0 +1,10 @@ +// rustfmt-where_layout: Mixed +// Where layout + +fn lorem(ipsum: Ipsum, dolor: Dolor) where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur { + // body +} + +fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur, Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit { + // body +} diff --git a/tests/source/configs-where_layout-vertical.rs b/tests/source/configs-where_layout-vertical.rs new file mode 100644 index 00000000000..76f2ed0bb4d --- /dev/null +++ b/tests/source/configs-where_layout-vertical.rs @@ -0,0 +1,10 @@ +// rustfmt-where_layout: Vertical +// Where layout + +fn lorem(ipsum: Ipsum, dolor: Dolor) where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur { + // body +} + +fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur, Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit { + // body +} diff --git a/tests/source/configs-where_pred_indent-block.rs b/tests/source/configs-where_pred_indent-block.rs new file mode 100644 index 00000000000..8474dc4dd01 --- /dev/null +++ b/tests/source/configs-where_pred_indent-block.rs @@ -0,0 +1,6 @@ +// rustfmt-where_pred_indent: Block +// Where predicate indent + +fn lorem() -> T where Ipsum: Eq, Dolor: Eq, Sit: Eq, Amet: Eq { + // body +} diff --git a/tests/source/configs-where_pred_indent-visual.rs b/tests/source/configs-where_pred_indent-visual.rs new file mode 100644 index 00000000000..79b7a371047 --- /dev/null +++ b/tests/source/configs-where_pred_indent-visual.rs @@ -0,0 +1,6 @@ +// rustfmt-where_pred_indent: Visual +// Where predicate indent + +fn lorem() -> T where Ipsum: Eq, Dolor: Eq, Sit: Eq, Amet: Eq { + // body +} diff --git a/tests/source/configs-where_style-default.rs b/tests/source/configs-where_style-default.rs new file mode 100644 index 00000000000..98f514b0c1e --- /dev/null +++ b/tests/source/configs-where_style-default.rs @@ -0,0 +1,6 @@ +// rustfmt-where_style: Default +// Where style + +fn lorem() -> T where Ipsum: Eq, Dolor: Eq, Sit: Eq, Amet: Eq { + // body +} diff --git a/tests/source/configs-where_style-rfc.rs b/tests/source/configs-where_style-rfc.rs new file mode 100644 index 00000000000..7b93cc9514a --- /dev/null +++ b/tests/source/configs-where_style-rfc.rs @@ -0,0 +1,6 @@ +// rustfmt-where_style: Rfc +// Where style + +fn lorem() -> T where Ipsum: Eq, Dolor: Eq, Sit: Eq, Amet: Eq { + // body +} diff --git a/tests/source/configs-wrap_comments-false.rs b/tests/source/configs-wrap_comments-false.rs new file mode 100644 index 00000000000..48ecd88accb --- /dev/null +++ b/tests/source/configs-wrap_comments-false.rs @@ -0,0 +1,8 @@ +// rustfmt-wrap_comments: false +// rustfmt-max_width: 50 +// rustfmt-error_on_line_overflow: false +// Wrap comments + +fn main() { + // Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. +} diff --git a/tests/source/configs-wrap_comments-true.rs b/tests/source/configs-wrap_comments-true.rs new file mode 100644 index 00000000000..0f6d021b28e --- /dev/null +++ b/tests/source/configs-wrap_comments-true.rs @@ -0,0 +1,7 @@ +// rustfmt-wrap_comments: true +// rustfmt-max_width: 50 +// Wrap comments + +fn main() { + // Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. +} diff --git a/tests/source/configs-wrap_match_arms-false.rs b/tests/source/configs-wrap_match_arms-false.rs new file mode 100644 index 00000000000..5d0337a0c7d --- /dev/null +++ b/tests/source/configs-wrap_match_arms-false.rs @@ -0,0 +1,14 @@ +// rustfmt-wrap_match_arms: false +// Wrap match-arms + +fn main() { + match lorem { + true => { + let ipsum = dolor; + println!("{:?}", ipsum); + } + false => { + println!("{}", sit) + } + } +} diff --git a/tests/source/configs-wrap_match_arms-true.rs b/tests/source/configs-wrap_match_arms-true.rs new file mode 100644 index 00000000000..fb74fb4f620 --- /dev/null +++ b/tests/source/configs-wrap_match_arms-true.rs @@ -0,0 +1,14 @@ +// rustfmt-wrap_match_arms: true +// Wrap match-arms + +fn main() { + match lorem { + true => { + let ipsum = dolor; + println!("{}", ipsum); + } + false => { + println!("{}", sit) + } + } +} diff --git a/tests/target/configs-array_layout-block.rs b/tests/target/configs-array_layout-block.rs new file mode 100644 index 00000000000..a95f808978a --- /dev/null +++ b/tests/target/configs-array_layout-block.rs @@ -0,0 +1,14 @@ +// rustfmt-array_layout: Block +// Array layout + +fn main() { + let lorem = vec![ + "ipsum", + "dolor", + "sit", + "amet", + "consectetur", + "adipiscing", + "elit", + ]; +} diff --git a/tests/target/configs-array_layout-visual.rs b/tests/target/configs-array_layout-visual.rs new file mode 100644 index 00000000000..07b5ae088e6 --- /dev/null +++ b/tests/target/configs-array_layout-visual.rs @@ -0,0 +1,12 @@ +// rustfmt-array_layout: Visual +// Array layout + +fn main() { + let lorem = vec!["ipsum", + "dolor", + "sit", + "amet", + "consectetur", + "adipiscing", + "elit"]; +} diff --git a/tests/target/configs-array_width-above.rs b/tests/target/configs-array_width-above.rs new file mode 100644 index 00000000000..8da896c1549 --- /dev/null +++ b/tests/target/configs-array_width-above.rs @@ -0,0 +1,12 @@ +// rustfmt-array_width: 10 +// Array width + +fn main() { + let lorem = vec!["ipsum", + "dolor", + "sit", + "amet", + "consectetur", + "adipiscing", + "elit"]; +} diff --git a/tests/target/configs-array_width-below.rs b/tests/target/configs-array_width-below.rs new file mode 100644 index 00000000000..d76d539773a --- /dev/null +++ b/tests/target/configs-array_width-below.rs @@ -0,0 +1,6 @@ +// rustfmt-array_width: 100 +// Array width + +fn main() { + let lorem = vec!["ipsum", "dolor", "sit", "amet", "consectetur", "adipiscing", "elit"]; +} diff --git a/tests/target/configs-chain_indent-block.rs b/tests/target/configs-chain_indent-block.rs new file mode 100644 index 00000000000..89357e55801 --- /dev/null +++ b/tests/target/configs-chain_indent-block.rs @@ -0,0 +1,12 @@ +// rustfmt-chain_indent: Block +// Chain indent + +fn main() { + let lorem = ipsum + .dolor() + .sit() + .amet() + .consectetur() + .adipiscing() + .elit(); +} diff --git a/tests/target/configs-chain_indent-visual.rs b/tests/target/configs-chain_indent-visual.rs new file mode 100644 index 00000000000..158ad432ffa --- /dev/null +++ b/tests/target/configs-chain_indent-visual.rs @@ -0,0 +1,11 @@ +// rustfmt-chain_indent: Visual +// Chain indent + +fn main() { + let lorem = ipsum.dolor() + .sit() + .amet() + .consectetur() + .adipiscing() + .elit(); +} diff --git a/tests/target/configs-chain_one_line_max-above.rs b/tests/target/configs-chain_one_line_max-above.rs new file mode 100644 index 00000000000..e766f0d0ea2 --- /dev/null +++ b/tests/target/configs-chain_one_line_max-above.rs @@ -0,0 +1,12 @@ +// rustfmt-chain_one_line_max: 10 +// Chain one line max + +fn main() { + let lorem = ipsum + .dolor() + .sit() + .amet() + .consectetur() + .adipiscing() + .elit(); +} diff --git a/tests/target/configs-chain_one_line_max-below.rs b/tests/target/configs-chain_one_line_max-below.rs new file mode 100644 index 00000000000..e869c782d07 --- /dev/null +++ b/tests/target/configs-chain_one_line_max-below.rs @@ -0,0 +1,6 @@ +// rustfmt-chain_one_line_max: 100 +// Chain one line max + +fn main() { + let lorem = ipsum.dolor().sit().amet().consectetur().adipiscing().elit(); +} diff --git a/tests/target/configs-closure_block_indent_threshold-10.rs b/tests/target/configs-closure_block_indent_threshold-10.rs new file mode 100644 index 00000000000..1a0c79ab234 --- /dev/null +++ b/tests/target/configs-closure_block_indent_threshold-10.rs @@ -0,0 +1,12 @@ +// rustfmt-closure_block_indent_threshold: 10 +// Closure block indent threshold + +fn main() { + lorem_ipsum(|| { + println!("lorem"); + println!("ipsum"); + println!("dolor"); + println!("sit"); + println!("amet"); + }); +} diff --git a/tests/target/configs-closure_block_indent_threshold-2.rs b/tests/target/configs-closure_block_indent_threshold-2.rs new file mode 100644 index 00000000000..089ac3288ef --- /dev/null +++ b/tests/target/configs-closure_block_indent_threshold-2.rs @@ -0,0 +1,12 @@ +// rustfmt-closure_block_indent_threshold: 2 +// Closure block indent threshold + +fn main() { + lorem_ipsum(|| { + println!("lorem"); + println!("ipsum"); + println!("dolor"); + println!("sit"); + println!("amet"); + }); +} diff --git a/tests/target/configs-comment_width-above.rs b/tests/target/configs-comment_width-above.rs new file mode 100644 index 00000000000..ddfecda65c1 --- /dev/null +++ b/tests/target/configs-comment_width-above.rs @@ -0,0 +1,8 @@ +// rustfmt-comment_width: 40 +// rustfmt-wrap_comments: true +// Comment width + +fn main() { + // Lorem ipsum dolor sit amet, + // consectetur adipiscing elit. +} diff --git a/tests/target/configs-comment_width-below.rs b/tests/target/configs-comment_width-below.rs new file mode 100644 index 00000000000..abbc5930c4c --- /dev/null +++ b/tests/target/configs-comment_width-below.rs @@ -0,0 +1,7 @@ +// rustfmt-comment_width: 80 +// rustfmt-wrap_comments: true +// Comment width + +fn main() { + // Lorem ipsum dolor sit amet, consectetur adipiscing elit. +} diff --git a/tests/target/configs-comment_width-ignore.rs b/tests/target/configs-comment_width-ignore.rs new file mode 100644 index 00000000000..c86e71c2898 --- /dev/null +++ b/tests/target/configs-comment_width-ignore.rs @@ -0,0 +1,7 @@ +// rustfmt-comment_width: 40 +// rustfmt-wrap_comments: false +// Comment width + +fn main() { + // Lorem ipsum dolor sit amet, consectetur adipiscing elit. +} diff --git a/tests/target/configs-condense_wildcard_suffices-false.rs b/tests/target/configs-condense_wildcard_suffices-false.rs new file mode 100644 index 00000000000..e4ad1f2f3cc --- /dev/null +++ b/tests/target/configs-condense_wildcard_suffices-false.rs @@ -0,0 +1,6 @@ +// rustfmt-condense_wildcard_suffices: false +// Condense wildcard suffices + +fn main() { + let (lorem, ipsum, _, _) = (1, 2, 3, 4); +} diff --git a/tests/target/configs-condense_wildcard_suffices-true.rs b/tests/target/configs-condense_wildcard_suffices-true.rs new file mode 100644 index 00000000000..03bd0c4c6c8 --- /dev/null +++ b/tests/target/configs-condense_wildcard_suffices-true.rs @@ -0,0 +1,6 @@ +// rustfmt-condense_wildcard_suffices: true +// Condense wildcard suffices + +fn main() { + let (lorem, ipsum, ..) = (1, 2, 3, 4); +} diff --git a/tests/target/configs-control_brace_style-always_next_line.rs b/tests/target/configs-control_brace_style-always_next_line.rs new file mode 100644 index 00000000000..74121aa44ae --- /dev/null +++ b/tests/target/configs-control_brace_style-always_next_line.rs @@ -0,0 +1,13 @@ +// rustfmt-control_brace_style: AlwaysNextLine +// Control brace style + +fn main() { + if lorem + { + println!("ipsum!"); + } + else + { + println!("dolor!"); + } +} diff --git a/tests/target/configs-control_brace_style-always_same_line.rs b/tests/target/configs-control_brace_style-always_same_line.rs new file mode 100644 index 00000000000..da14b23971d --- /dev/null +++ b/tests/target/configs-control_brace_style-always_same_line.rs @@ -0,0 +1,10 @@ +// rustfmt-control_brace_style: AlwaysSameLine +// Control brace style + +fn main() { + if lorem { + println!("ipsum!"); + } else { + println!("dolor!"); + } +} diff --git a/tests/target/configs-control_brace_style-closing_next_line.rs b/tests/target/configs-control_brace_style-closing_next_line.rs new file mode 100644 index 00000000000..a7a3adc756a --- /dev/null +++ b/tests/target/configs-control_brace_style-closing_next_line.rs @@ -0,0 +1,11 @@ +// rustfmt-control_brace_style: ClosingNextLine +// Control brace style + +fn main() { + if lorem { + println!("ipsum!"); + } + else { + println!("dolor!"); + } +} diff --git a/tests/target/configs-disable_all_formatting-false.rs b/tests/target/configs-disable_all_formatting-false.rs new file mode 100644 index 00000000000..1a0477ddb39 --- /dev/null +++ b/tests/target/configs-disable_all_formatting-false.rs @@ -0,0 +1,10 @@ +// rustfmt-disable_all_formatting: false +// Disable all formatting + +fn main() { + if lorem { + println!("ipsum!"); + } else { + println!("dolor!"); + } +} diff --git a/tests/target/configs-disable_all_formatting-true.rs b/tests/target/configs-disable_all_formatting-true.rs new file mode 100644 index 00000000000..736ccf56942 --- /dev/null +++ b/tests/target/configs-disable_all_formatting-true.rs @@ -0,0 +1,6 @@ +// rustfmt-disable_all_formatting: true +// Disable all formatting + +fn main() { + if lorem{println!("ipsum!");}else{println!("dolor!");} +} diff --git a/tests/target/configs-error_on_line_overflow-false.rs b/tests/target/configs-error_on_line_overflow-false.rs new file mode 100644 index 00000000000..fa70ae78352 --- /dev/null +++ b/tests/target/configs-error_on_line_overflow-false.rs @@ -0,0 +1,6 @@ +// rustfmt-error_on_line_overflow: false +// Error on line overflow + +fn main() { + let lorem_ipsum_dolor_sit_amet_consectetur_adipiscing_elit_lorem_ipsum_dolor_sit_amet_consectetur_adipiscing_elit; +} diff --git a/tests/target/configs-fn_args_density-compressed.rs b/tests/target/configs-fn_args_density-compressed.rs new file mode 100644 index 00000000000..5a24766d3b9 --- /dev/null +++ b/tests/target/configs-fn_args_density-compressed.rs @@ -0,0 +1,18 @@ +// rustfmt-fn_args_density: Compressed +// Function arguments density + +trait Lorem { + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet); + + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) { + // body + } + + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, + adipiscing: Adipiscing, elit: Elit); + + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, + adipiscing: Adipiscing, elit: Elit) { + // body + } +} diff --git a/tests/target/configs-fn_args_density-compressed_if_empty.rs b/tests/target/configs-fn_args_density-compressed_if_empty.rs new file mode 100644 index 00000000000..c2fea2badd6 --- /dev/null +++ b/tests/target/configs-fn_args_density-compressed_if_empty.rs @@ -0,0 +1,32 @@ +// rustfmt-fn_args_density: CompressedIfEmpty +// Function arguments density + +trait Lorem { + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet); + + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) { + // body + } + + fn lorem(ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, + consectetur: onsectetur, + adipiscing: Adipiscing, + elit: Elit); + + // FIXME: Previous line should be formatted like this: + // fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet, consectetur: onsectetur, + // adipiscing: Adipiscing, elit: Elit); + + fn lorem(ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, + consectetur: onsectetur, + adipiscing: Adipiscing, + elit: Elit) { + // body + } +} diff --git a/tests/target/configs-fn_args_density-tall.rs b/tests/target/configs-fn_args_density-tall.rs new file mode 100644 index 00000000000..856501382f3 --- /dev/null +++ b/tests/target/configs-fn_args_density-tall.rs @@ -0,0 +1,28 @@ +// rustfmt-fn_args_density: Tall +// Function arguments density + +trait Lorem { + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet); + + fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) { + // body + } + + fn lorem(ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, + consectetur: onsectetur, + adipiscing: Adipiscing, + elit: Elit); + + fn lorem(ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, + consectetur: onsectetur, + adipiscing: Adipiscing, + elit: Elit) { + // body + } +} diff --git a/tests/target/configs-fn_args_density-vertical.rs b/tests/target/configs-fn_args_density-vertical.rs new file mode 100644 index 00000000000..ac4ef01efda --- /dev/null +++ b/tests/target/configs-fn_args_density-vertical.rs @@ -0,0 +1,34 @@ +// rustfmt-fn_args_density: Vertical +// Function arguments density + +trait Lorem { + fn lorem(ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet); + + fn lorem(ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet) { + // body + } + + fn lorem(ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, + consectetur: onsectetur, + adipiscing: Adipiscing, + elit: Elit); + + fn lorem(ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, + consectetur: onsectetur, + adipiscing: Adipiscing, + elit: Elit) { + // body + } +} diff --git a/tests/target/configs-fn_args_layout-block.rs b/tests/target/configs-fn_args_layout-block.rs new file mode 100644 index 00000000000..2eab7d953a5 --- /dev/null +++ b/tests/target/configs-fn_args_layout-block.rs @@ -0,0 +1,18 @@ +// rustfmt-fn_args_layout: Block +// Function arguments layout + +fn lorem() {} + +fn lorem(ipsum: usize) {} + +fn lorem( + ipsum: usize, + dolor: usize, + sit: usize, + amet: usize, + consectetur: usize, + adipiscing: usize, + elit: usize, +) { + // body +} diff --git a/tests/target/configs-fn_args_layout-visual.rs b/tests/target/configs-fn_args_layout-visual.rs new file mode 100644 index 00000000000..834cac446a9 --- /dev/null +++ b/tests/target/configs-fn_args_layout-visual.rs @@ -0,0 +1,16 @@ +// rustfmt-fn_args_layout: Visual +// Function arguments layout + +fn lorem() {} + +fn lorem(ipsum: usize) {} + +fn lorem(ipsum: usize, + dolor: usize, + sit: usize, + amet: usize, + consectetur: usize, + adipiscing: usize, + elit: usize) { + // body +} diff --git a/tests/target/configs-fn_args_paren_newline-false.rs b/tests/target/configs-fn_args_paren_newline-false.rs new file mode 100644 index 00000000000..ad2aec11ea8 --- /dev/null +++ b/tests/target/configs-fn_args_paren_newline-false.rs @@ -0,0 +1,11 @@ +// rustfmt-fn_args_paren_newline: false +// Function arguments parenthesis on a newline + +fn lorem( + ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet) + -> DolorSitAmetConsecteturAdipiscingElitLoremIpsumDolorSitAmetConsecteturAdipiscingElit { + // body +} diff --git a/tests/target/configs-fn_args_paren_newline-true.rs b/tests/target/configs-fn_args_paren_newline-true.rs new file mode 100644 index 00000000000..19b9c342b9c --- /dev/null +++ b/tests/target/configs-fn_args_paren_newline-true.rs @@ -0,0 +1,11 @@ +// rustfmt-fn_args_paren_newline: true +// Function arguments parenthesis on a newline + +fn lorem + (ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet) + -> DolorSitAmetConsecteturAdipiscingElitLoremIpsumDolorSitAmetConsecteturAdipiscingElit { + // body +} diff --git a/tests/target/configs-fn_brace_style-always_next_line.rs b/tests/target/configs-fn_brace_style-always_next_line.rs new file mode 100644 index 00000000000..a249cdf87d9 --- /dev/null +++ b/tests/target/configs-fn_brace_style-always_next_line.rs @@ -0,0 +1,18 @@ +// rustfmt-fn_brace_style: AlwaysNextLine +// Function brace style + +fn lorem() +{ + // body +} + +fn lorem(ipsum: usize) +{ + // body +} + +fn lorem(ipsum: T) + where T: Add + Sub + Mul + Div +{ + // body +} diff --git a/tests/target/configs-fn_brace_style-prefer_same_line.rs b/tests/target/configs-fn_brace_style-prefer_same_line.rs new file mode 100644 index 00000000000..25d05f761e4 --- /dev/null +++ b/tests/target/configs-fn_brace_style-prefer_same_line.rs @@ -0,0 +1,15 @@ +// rustfmt-fn_brace_style: PreferSameLine +// Function brace style + +fn lorem() { + // body +} + +fn lorem(ipsum: usize) { + // body +} + +fn lorem(ipsum: T) + where T: Add + Sub + Mul + Div { + // body +} diff --git a/tests/target/configs-fn_brace_style-same_line_where.rs b/tests/target/configs-fn_brace_style-same_line_where.rs new file mode 100644 index 00000000000..664f256e122 --- /dev/null +++ b/tests/target/configs-fn_brace_style-same_line_where.rs @@ -0,0 +1,16 @@ +// rustfmt-fn_brace_style: SameLineWhere +// Function brace style + +fn lorem() { + // body +} + +fn lorem(ipsum: usize) { + // body +} + +fn lorem(ipsum: T) + where T: Add + Sub + Mul + Div +{ + // body +} diff --git a/tests/target/configs-fn_call_style-block.rs b/tests/target/configs-fn_call_style-block.rs new file mode 100644 index 00000000000..df2fb9207bb --- /dev/null +++ b/tests/target/configs-fn_call_style-block.rs @@ -0,0 +1,15 @@ +// rustfmt-fn_call_style: Block +// Function call style + +fn main() { + lorem( + "lorem", + "ipsum", + "dolor", + "sit", + "amet", + "consectetur", + "adipiscing", + "elit", + ); +} diff --git a/tests/target/configs-fn_call_style-visual.rs b/tests/target/configs-fn_call_style-visual.rs new file mode 100644 index 00000000000..598c2fff280 --- /dev/null +++ b/tests/target/configs-fn_call_style-visual.rs @@ -0,0 +1,13 @@ +// rustfmt-fn_call_style: Visual +// Function call style + +fn main() { + lorem("lorem", + "ipsum", + "dolor", + "sit", + "amet", + "consectetur", + "adipiscing", + "elit"); +} diff --git a/tests/target/configs-fn_call_width-above.rs b/tests/target/configs-fn_call_width-above.rs new file mode 100644 index 00000000000..5e763106072 --- /dev/null +++ b/tests/target/configs-fn_call_width-above.rs @@ -0,0 +1,13 @@ +// rustfmt-fn_call_width: 10 +// Function call width + +fn main() { + lorem("lorem", + "ipsum", + "dolor", + "sit", + "amet", + "consectetur", + "adipiscing", + "elit"); +} diff --git a/tests/target/configs-fn_call_width-below.rs b/tests/target/configs-fn_call_width-below.rs new file mode 100644 index 00000000000..b79918f5b98 --- /dev/null +++ b/tests/target/configs-fn_call_width-below.rs @@ -0,0 +1,6 @@ +// rustfmt-fn_call_width: 100 +// Function call width + +fn main() { + lorem("lorem", "ipsum", "dolor"); +} diff --git a/tests/target/configs-fn_empty_single_line-false.rs b/tests/target/configs-fn_empty_single_line-false.rs new file mode 100644 index 00000000000..86a279b5869 --- /dev/null +++ b/tests/target/configs-fn_empty_single_line-false.rs @@ -0,0 +1,9 @@ +// rustfmt-fn_empty_single_line: false +// Empty function on single line + +fn lorem() { +} + +fn lorem() { + +} diff --git a/tests/target/configs-fn_empty_single_line-true.rs b/tests/target/configs-fn_empty_single_line-true.rs new file mode 100644 index 00000000000..a54cd5e6f3f --- /dev/null +++ b/tests/target/configs-fn_empty_single_line-true.rs @@ -0,0 +1,6 @@ +// rustfmt-fn_empty_single_line: true +// Empty function on single line + +fn lorem() {} + +fn lorem() {} diff --git a/tests/target/configs-fn_return_indent-with_args.rs b/tests/target/configs-fn_return_indent-with_args.rs new file mode 100644 index 00000000000..ab08d0bfe0f --- /dev/null +++ b/tests/target/configs-fn_return_indent-with_args.rs @@ -0,0 +1,14 @@ +// rustfmt-fn_return_indent: WithArgs +// Function return type indent + +fn lorem(ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, + consectetur: Consectetur, + adipiscing: Adipiscing) + -> Elit + where Ipsum: Eq +{ + // body +} diff --git a/tests/target/configs-fn_return_indent-with_where_clause.rs b/tests/target/configs-fn_return_indent-with_where_clause.rs new file mode 100644 index 00000000000..279949c982b --- /dev/null +++ b/tests/target/configs-fn_return_indent-with_where_clause.rs @@ -0,0 +1,14 @@ +// rustfmt-fn_return_indent: WithWhereClause +// Function return type indent + +fn lorem(ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, + consectetur: Consectetur, + adipiscing: Adipiscing) + -> Elit + where Ipsum: Eq +{ + // body +} diff --git a/tests/target/configs-fn_single_line-false.rs b/tests/target/configs-fn_single_line-false.rs new file mode 100644 index 00000000000..3d092f0c0bf --- /dev/null +++ b/tests/target/configs-fn_single_line-false.rs @@ -0,0 +1,11 @@ +// rustfmt-fn_single_line: false +// Single-expression function on single line + +fn lorem() -> usize { + 42 +} + +fn lorem() -> usize { + let ipsum = 42; + ipsum +} diff --git a/tests/target/configs-fn_single_line-true.rs b/tests/target/configs-fn_single_line-true.rs new file mode 100644 index 00000000000..10d94e02f16 --- /dev/null +++ b/tests/target/configs-fn_single_line-true.rs @@ -0,0 +1,9 @@ +// rustfmt-fn_single_line: true +// Single-expression function on single line + +fn lorem() -> usize { 42 } + +fn lorem() -> usize { + let ipsum = 42; + ipsum +} diff --git a/tests/target/configs-force_explicit_abi-false.rs b/tests/target/configs-force_explicit_abi-false.rs new file mode 100644 index 00000000000..3c48f8e0c78 --- /dev/null +++ b/tests/target/configs-force_explicit_abi-false.rs @@ -0,0 +1,6 @@ +// rustfmt-force_explicit_abi: false +// Force explicit abi + +extern { + pub static lorem: c_int; +} diff --git a/tests/target/configs-force_explicit_abi-true.rs b/tests/target/configs-force_explicit_abi-true.rs new file mode 100644 index 00000000000..90f5a8c4ecb --- /dev/null +++ b/tests/target/configs-force_explicit_abi-true.rs @@ -0,0 +1,6 @@ +// rustfmt-force_explicit_abi: true +// Force explicit abi + +extern "C" { + pub static lorem: c_int; +} diff --git a/tests/target/configs-force_format_strings-false.rs b/tests/target/configs-force_format_strings-false.rs new file mode 100644 index 00000000000..49f32c557b3 --- /dev/null +++ b/tests/target/configs-force_format_strings-false.rs @@ -0,0 +1,9 @@ +// rustfmt-force_format_strings: false +// rustfmt-format_strings: false +// rustfmt-max_width: 50 +// rustfmt-error_on_line_overflow: false +// Force format strings + +fn main() { + let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit"; +} diff --git a/tests/target/configs-force_format_strings-true.rs b/tests/target/configs-force_format_strings-true.rs new file mode 100644 index 00000000000..875d89dd2f9 --- /dev/null +++ b/tests/target/configs-force_format_strings-true.rs @@ -0,0 +1,10 @@ +// rustfmt-force_format_strings: true +// rustfmt-format_strings: false +// rustfmt-max_width: 50 +// Force format strings + +fn main() { + let lorem = + "ipsum dolor sit amet consectetur \ + adipiscing elit lorem ipsum dolor sit"; +} diff --git a/tests/target/configs-format_strings-false.rs b/tests/target/configs-format_strings-false.rs new file mode 100644 index 00000000000..ecca0d7d1fc --- /dev/null +++ b/tests/target/configs-format_strings-false.rs @@ -0,0 +1,8 @@ +// rustfmt-format_strings: false +// rustfmt-max_width: 50 +// rustfmt-error_on_line_overflow: false +// Force format strings + +fn main() { + let lorem = "ipsum dolor sit amet consectetur adipiscing elit lorem ipsum dolor sit"; +} diff --git a/tests/target/configs-format_strings-true.rs b/tests/target/configs-format_strings-true.rs new file mode 100644 index 00000000000..84f84380b25 --- /dev/null +++ b/tests/target/configs-format_strings-true.rs @@ -0,0 +1,9 @@ +// rustfmt-format_strings: true +// rustfmt-max_width: 50 +// Force format strings + +fn main() { + let lorem = + "ipsum dolor sit amet consectetur \ + adipiscing elit lorem ipsum dolor sit"; +} diff --git a/tests/target/configs-generics_indent-block.rs b/tests/target/configs-generics_indent-block.rs new file mode 100644 index 00000000000..789243c02c3 --- /dev/null +++ b/tests/target/configs-generics_indent-block.rs @@ -0,0 +1,21 @@ +// rustfmt-generics_indent: Block +// Generics indent + +fn lorem< + Ipsum: Eq = usize, + Dolor: Eq = usize, + Sit: Eq = usize, + Amet: Eq = usize, + Adipiscing: Eq = usize, + Consectetur: Eq = usize, + Elit: Eq = usize +>(ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, + adipiscing: Adipiscing, + consectetur: Consectetur, + elit: Elit) + -> T { + // body +} diff --git a/tests/target/configs-generics_indent-visual.rs b/tests/target/configs-generics_indent-visual.rs new file mode 100644 index 00000000000..6ae0f775c22 --- /dev/null +++ b/tests/target/configs-generics_indent-visual.rs @@ -0,0 +1,20 @@ +// rustfmt-generics_indent: Visual +// Generics indent + +fn lorem + (ipsum: Ipsum, + dolor: Dolor, + sit: Sit, + amet: Amet, + adipiscing: Adipiscing, + consectetur: Consectetur, + elit: Elit) + -> T { + // body +} diff --git a/tests/target/configs-hard_tabs-false.rs b/tests/target/configs-hard_tabs-false.rs new file mode 100644 index 00000000000..ccfb53d8c86 --- /dev/null +++ b/tests/target/configs-hard_tabs-false.rs @@ -0,0 +1,6 @@ +// rustfmt-hard_tabs: false +// Hard tabs + +fn lorem() -> usize { + 42 // spaces before 42 +} diff --git a/tests/target/configs-hard_tabs-true.rs b/tests/target/configs-hard_tabs-true.rs new file mode 100644 index 00000000000..3ed4e4f20aa --- /dev/null +++ b/tests/target/configs-hard_tabs-true.rs @@ -0,0 +1,6 @@ +// rustfmt-hard_tabs: true +// Hard tabs + +fn lorem() -> usize { + 42 // spaces before 42 +} diff --git a/tests/target/configs-impl_empty_single_line-false.rs b/tests/target/configs-impl_empty_single_line-false.rs new file mode 100644 index 00000000000..c8f97efec0a --- /dev/null +++ b/tests/target/configs-impl_empty_single_line-false.rs @@ -0,0 +1,8 @@ +// rustfmt-impl_empty_single_line: false +// Empty impl on single line + +impl Lorem { +} + +impl Ipsum { +} diff --git a/tests/target/configs-impl_empty_single_line-true.rs b/tests/target/configs-impl_empty_single_line-true.rs new file mode 100644 index 00000000000..9a485d2d877 --- /dev/null +++ b/tests/target/configs-impl_empty_single_line-true.rs @@ -0,0 +1,6 @@ +// rustfmt-impl_empty_single_line: true +// Empty impl on single line + +impl Lorem {} + +impl Ipsum {} diff --git a/tests/target/configs-indent_match_arms-false.rs b/tests/target/configs-indent_match_arms-false.rs new file mode 100644 index 00000000000..3084e01d45f --- /dev/null +++ b/tests/target/configs-indent_match_arms-false.rs @@ -0,0 +1,11 @@ +// rustfmt-indent_match_arms: false +// Indent match arms + +fn main() { + match lorem { + Lorem::Ipsum => (), + Lorem::Dolor => (), + Lorem::Sit => (), + Lorem::Amet => (), + } +} diff --git a/tests/target/configs-indent_match_arms-true.rs b/tests/target/configs-indent_match_arms-true.rs new file mode 100644 index 00000000000..02e2368378f --- /dev/null +++ b/tests/target/configs-indent_match_arms-true.rs @@ -0,0 +1,11 @@ +// rustfmt-indent_match_arms: true +// Indent match arms + +fn main() { + match lorem { + Lorem::Ipsum => (), + Lorem::Dolor => (), + Lorem::Sit => (), + Lorem::Amet => (), + } +} diff --git a/tests/target/configs-item_brace_style-always_next_line.rs b/tests/target/configs-item_brace_style-always_next_line.rs new file mode 100644 index 00000000000..6095149a514 --- /dev/null +++ b/tests/target/configs-item_brace_style-always_next_line.rs @@ -0,0 +1,13 @@ +// rustfmt-item_brace_style: AlwaysNextLine +// Item brace style + +struct Lorem +{ + ipsum: bool, +} + +struct Dolor + where T: Eq +{ + sit: T, +} diff --git a/tests/target/configs-item_brace_style-prefer_same_line.rs b/tests/target/configs-item_brace_style-prefer_same_line.rs new file mode 100644 index 00000000000..0b65ecc30c1 --- /dev/null +++ b/tests/target/configs-item_brace_style-prefer_same_line.rs @@ -0,0 +1,11 @@ +// rustfmt-item_brace_style: PreferSameLine +// Item brace style + +struct Lorem { + ipsum: bool, +} + +struct Dolor + where T: Eq { + sit: T, +} diff --git a/tests/target/configs-item_brace_style-same_line_where.rs b/tests/target/configs-item_brace_style-same_line_where.rs new file mode 100644 index 00000000000..33d6501f424 --- /dev/null +++ b/tests/target/configs-item_brace_style-same_line_where.rs @@ -0,0 +1,12 @@ +// rustfmt-item_brace_style: SameLineWhere +// Item brace style + +struct Lorem { + ipsum: bool, +} + +struct Dolor + where T: Eq +{ + sit: T, +} diff --git a/tests/target/configs-match_block_trailing_comma-false.rs b/tests/target/configs-match_block_trailing_comma-false.rs new file mode 100644 index 00000000000..70e02955fb0 --- /dev/null +++ b/tests/target/configs-match_block_trailing_comma-false.rs @@ -0,0 +1,11 @@ +// rustfmt-match_block_trailing_comma: false +// Match block trailing comma + +fn main() { + match lorem { + Lorem::Ipsum => { + println!("ipsum"); + } + Lorem::Dolor => println!("dolor"), + } +} diff --git a/tests/target/configs-match_block_trailing_comma-true.rs b/tests/target/configs-match_block_trailing_comma-true.rs new file mode 100644 index 00000000000..b78b046dc1c --- /dev/null +++ b/tests/target/configs-match_block_trailing_comma-true.rs @@ -0,0 +1,11 @@ +// rustfmt-match_block_trailing_comma: true +// Match block trailing comma + +fn main() { + match lorem { + Lorem::Ipsum => { + println!("ipsum"); + }, + Lorem::Dolor => println!("dolor"), + } +} diff --git a/tests/target/configs-normalize_comments-false.rs b/tests/target/configs-normalize_comments-false.rs new file mode 100644 index 00000000000..6bb214330a1 --- /dev/null +++ b/tests/target/configs-normalize_comments-false.rs @@ -0,0 +1,8 @@ +// rustfmt-normalize_comments: false +// Normalize comments + +// Lorem ipsum: +fn dolor() -> usize {} + +/* sit amet: */ +fn adipiscing() -> usize {} diff --git a/tests/target/configs-normalize_comments-true.rs b/tests/target/configs-normalize_comments-true.rs new file mode 100644 index 00000000000..e5f2d06fbe8 --- /dev/null +++ b/tests/target/configs-normalize_comments-true.rs @@ -0,0 +1,8 @@ +// rustfmt-normalize_comments: true +// Normalize comments + +// Lorem ipsum: +fn dolor() -> usize {} + +// sit amet: +fn adipiscing() -> usize {} diff --git a/tests/target/configs-reorder_imported_names-false.rs b/tests/target/configs-reorder_imported_names-false.rs new file mode 100644 index 00000000000..91db89ceeaa --- /dev/null +++ b/tests/target/configs-reorder_imported_names-false.rs @@ -0,0 +1,4 @@ +// rustfmt-reorder_imported_names: false +// Reorder imported names + +use super::{lorem, ipsum, dolor, sit}; diff --git a/tests/target/configs-reorder_imported_names-true.rs b/tests/target/configs-reorder_imported_names-true.rs new file mode 100644 index 00000000000..59f55f4718a --- /dev/null +++ b/tests/target/configs-reorder_imported_names-true.rs @@ -0,0 +1,4 @@ +// rustfmt-reorder_imported_names: true +// Reorder imported names + +use super::{dolor, ipsum, lorem, sit}; diff --git a/tests/target/configs-reorder_imports-false.rs b/tests/target/configs-reorder_imports-false.rs new file mode 100644 index 00000000000..4b85684dc01 --- /dev/null +++ b/tests/target/configs-reorder_imports-false.rs @@ -0,0 +1,7 @@ +// rustfmt-reorder_imports: false +// Reorder imports + +use lorem; +use ipsum; +use dolor; +use sit; diff --git a/tests/target/configs-reorder_imports-true.rs b/tests/target/configs-reorder_imports-true.rs new file mode 100644 index 00000000000..29dace00013 --- /dev/null +++ b/tests/target/configs-reorder_imports-true.rs @@ -0,0 +1,7 @@ +// rustfmt-reorder_imports: true +// Reorder imports + +use dolor; +use ipsum; +use lorem; +use sit; diff --git a/tests/target/configs-single_line_if_else_max_width-above.rs b/tests/target/configs-single_line_if_else_max_width-above.rs new file mode 100644 index 00000000000..d883dbbb469 --- /dev/null +++ b/tests/target/configs-single_line_if_else_max_width-above.rs @@ -0,0 +1,10 @@ +// rustfmt-single_line_if_else_max_width: 10 +// Single line if-else max width + +fn main() { + let lorem = if ipsum { + dolor + } else { + sit + }; +} diff --git a/tests/target/configs-single_line_if_else_max_width-below.rs b/tests/target/configs-single_line_if_else_max_width-below.rs new file mode 100644 index 00000000000..efafa6c4498 --- /dev/null +++ b/tests/target/configs-single_line_if_else_max_width-below.rs @@ -0,0 +1,6 @@ +// rustfmt-single_line_if_else_max_width: 100 +// Single line if-else max width + +fn main() { + let lorem = if ipsum { dolor } else { sit }; +} diff --git a/tests/target/configs-space_after_bound_colon-false.rs b/tests/target/configs-space_after_bound_colon-false.rs new file mode 100644 index 00000000000..d254246b0f0 --- /dev/null +++ b/tests/target/configs-space_after_bound_colon-false.rs @@ -0,0 +1,6 @@ +// rustfmt-space_after_bound_colon: false +// Space after bound colon + +fn lorem(t: T) { + // body +} diff --git a/tests/target/configs-space_after_bound_colon-true.rs b/tests/target/configs-space_after_bound_colon-true.rs new file mode 100644 index 00000000000..301b07dfa82 --- /dev/null +++ b/tests/target/configs-space_after_bound_colon-true.rs @@ -0,0 +1,6 @@ +// rustfmt-space_after_bound_colon: true +// Space after bound colon + +fn lorem(t: T) { + // body +} diff --git a/tests/target/configs-space_after_type_annotation_colon-false.rs b/tests/target/configs-space_after_type_annotation_colon-false.rs new file mode 100644 index 00000000000..d27a5af3761 --- /dev/null +++ b/tests/target/configs-space_after_type_annotation_colon-false.rs @@ -0,0 +1,6 @@ +// rustfmt-space_after_type_annotation_colon: false +// Space after type annotation colon + +fn lorem(t:T) { + let ipsum:Dolor = sit; +} diff --git a/tests/target/configs-space_after_type_annotation_colon-true.rs b/tests/target/configs-space_after_type_annotation_colon-true.rs new file mode 100644 index 00000000000..ba0da25f836 --- /dev/null +++ b/tests/target/configs-space_after_type_annotation_colon-true.rs @@ -0,0 +1,6 @@ +// rustfmt-space_after_type_annotation_colon: true +// Space after type annotation colon + +fn lorem(t: T) { + let ipsum: Dolor = sit; +} diff --git a/tests/target/configs-space_before_bound-false.rs b/tests/target/configs-space_before_bound-false.rs new file mode 100644 index 00000000000..16e14bb77e3 --- /dev/null +++ b/tests/target/configs-space_before_bound-false.rs @@ -0,0 +1,6 @@ +// rustfmt-space_before_bound: false +// Space before bound + +fn lorem(t: T) { + let ipsum: Dolor = sit; +} diff --git a/tests/target/configs-space_before_bound-true.rs b/tests/target/configs-space_before_bound-true.rs new file mode 100644 index 00000000000..3ee3dffb20a --- /dev/null +++ b/tests/target/configs-space_before_bound-true.rs @@ -0,0 +1,6 @@ +// rustfmt-space_before_bound: true +// Space before bound + +fn lorem(t: T) { + let ipsum: Dolor = sit; +} diff --git a/tests/target/configs-space_before_type_annotation-false.rs b/tests/target/configs-space_before_type_annotation-false.rs new file mode 100644 index 00000000000..b75144f7ca6 --- /dev/null +++ b/tests/target/configs-space_before_type_annotation-false.rs @@ -0,0 +1,6 @@ +// rustfmt-space_before_type_annotation: false +// Space before type-annotation + +fn lorem(t: T) { + let ipsum: Dolor = sit; +} diff --git a/tests/target/configs-space_before_type_annotation-true.rs b/tests/target/configs-space_before_type_annotation-true.rs new file mode 100644 index 00000000000..355cf9f5db9 --- /dev/null +++ b/tests/target/configs-space_before_type_annotation-true.rs @@ -0,0 +1,6 @@ +// rustfmt-space_before_type_annotation: true +// Space before type-annotation + +fn lorem(t : T) { + let ipsum : Dolor = sit; +} diff --git a/tests/target/configs-spaces_around_ranges-false.rs b/tests/target/configs-spaces_around_ranges-false.rs new file mode 100644 index 00000000000..3d431e4d1ce --- /dev/null +++ b/tests/target/configs-spaces_around_ranges-false.rs @@ -0,0 +1,6 @@ +// rustfmt-spaces_around_ranges: false +// Spaces around ranges + +fn main() { + let lorem = 0..10; +} diff --git a/tests/target/configs-spaces_around_ranges-true.rs b/tests/target/configs-spaces_around_ranges-true.rs new file mode 100644 index 00000000000..2a456a6daea --- /dev/null +++ b/tests/target/configs-spaces_around_ranges-true.rs @@ -0,0 +1,6 @@ +// rustfmt-spaces_around_ranges: true +// Spaces around ranges + +fn main() { + let lorem = 0 .. 10; +} diff --git a/tests/target/configs-spaces_within_angle_brackets-false.rs b/tests/target/configs-spaces_within_angle_brackets-false.rs new file mode 100644 index 00000000000..3823216f433 --- /dev/null +++ b/tests/target/configs-spaces_within_angle_brackets-false.rs @@ -0,0 +1,6 @@ +// rustfmt-spaces_within_angle_brackets: false +// Spaces within angle-brackets + +fn lorem(t: T) { + // body +} diff --git a/tests/target/configs-spaces_within_angle_brackets-true.rs b/tests/target/configs-spaces_within_angle_brackets-true.rs new file mode 100644 index 00000000000..fef5ac25a4d --- /dev/null +++ b/tests/target/configs-spaces_within_angle_brackets-true.rs @@ -0,0 +1,6 @@ +// rustfmt-spaces_within_angle_brackets: true +// Spaces within angle-brackets + +fn lorem< T: Eq >(t: T) { + // body +} diff --git a/tests/target/configs-spaces_within_parens-false.rs b/tests/target/configs-spaces_within_parens-false.rs new file mode 100644 index 00000000000..05c25584fe1 --- /dev/null +++ b/tests/target/configs-spaces_within_parens-false.rs @@ -0,0 +1,6 @@ +// rustfmt-spaces_within_parens: false +// Spaces within parens + +fn lorem(t: T) { + let lorem = (ipsum, dolor); +} diff --git a/tests/target/configs-spaces_within_parens-true.rs b/tests/target/configs-spaces_within_parens-true.rs new file mode 100644 index 00000000000..2461afb7088 --- /dev/null +++ b/tests/target/configs-spaces_within_parens-true.rs @@ -0,0 +1,6 @@ +// rustfmt-spaces_within_parens: true +// Spaces within parens + +fn lorem( t: T ) { + let lorem = ( ipsum, dolor ); +} diff --git a/tests/target/configs-spaces_within_square_brackets-false.rs b/tests/target/configs-spaces_within_square_brackets-false.rs new file mode 100644 index 00000000000..6410646aad6 --- /dev/null +++ b/tests/target/configs-spaces_within_square_brackets-false.rs @@ -0,0 +1,6 @@ +// rustfmt-spaces_within_square_brackets: false +// Spaces within square-brackets + +fn main() { + let lorem: [usize; 2] = [ipsum, dolor]; +} diff --git a/tests/target/configs-spaces_within_square_brackets-true.rs b/tests/target/configs-spaces_within_square_brackets-true.rs new file mode 100644 index 00000000000..25f5e0e7231 --- /dev/null +++ b/tests/target/configs-spaces_within_square_brackets-true.rs @@ -0,0 +1,6 @@ +// rustfmt-spaces_within_square_brackets: true +// Spaces within square-brackets + +fn main() { + let lorem: [ usize; 2 ] = [ ipsum, dolor ]; +} diff --git a/tests/target/configs-struct_lit_multiline_style-force_multi.rs b/tests/target/configs-struct_lit_multiline_style-force_multi.rs new file mode 100644 index 00000000000..1abd2f09d9c --- /dev/null +++ b/tests/target/configs-struct_lit_multiline_style-force_multi.rs @@ -0,0 +1,9 @@ +// rustfmt-struct_lit_multiline_style: ForceMulti +// Struct literal multiline-style + +fn main() { + let lorem = Lorem { + ipsum: dolor, + sit: amet, + }; +} diff --git a/tests/target/configs-struct_lit_multiline_style-prefer_single.rs b/tests/target/configs-struct_lit_multiline_style-prefer_single.rs new file mode 100644 index 00000000000..9a4ac481335 --- /dev/null +++ b/tests/target/configs-struct_lit_multiline_style-prefer_single.rs @@ -0,0 +1,7 @@ +// rustfmt-struct_lit_multiline_style: PreferSingle +// rustfmt-struct_lit_width: 100 +// Struct literal multiline-style + +fn main() { + let lorem = Lorem { ipsum: dolor, sit: amet }; +} diff --git a/tests/target/configs-struct_lit_style-block.rs b/tests/target/configs-struct_lit_style-block.rs new file mode 100644 index 00000000000..dc64fcfd159 --- /dev/null +++ b/tests/target/configs-struct_lit_style-block.rs @@ -0,0 +1,9 @@ +// rustfmt-struct_lit_style: Block +// Struct literal-style + +fn main() { + let lorem = Lorem { + ipsum: dolor, + sit: amet, + }; +} diff --git a/tests/target/configs-struct_lit_style-visual.rs b/tests/target/configs-struct_lit_style-visual.rs new file mode 100644 index 00000000000..685ded59aad --- /dev/null +++ b/tests/target/configs-struct_lit_style-visual.rs @@ -0,0 +1,7 @@ +// rustfmt-struct_lit_style: Visual +// Struct literal-style + +fn main() { + let lorem = Lorem { ipsum: dolor, + sit: amet, }; +} diff --git a/tests/target/configs-struct_lit_width-above.rs b/tests/target/configs-struct_lit_width-above.rs new file mode 100644 index 00000000000..75a1a64095d --- /dev/null +++ b/tests/target/configs-struct_lit_width-above.rs @@ -0,0 +1,9 @@ +// rustfmt-struct_lit_width: 10 +// Struct literal-style + +fn main() { + let lorem = Lorem { + ipsum: dolor, + sit: amet, + }; +} diff --git a/tests/target/configs-struct_lit_width-below.rs b/tests/target/configs-struct_lit_width-below.rs new file mode 100644 index 00000000000..7ffe4a32eaf --- /dev/null +++ b/tests/target/configs-struct_lit_width-below.rs @@ -0,0 +1,6 @@ +// rustfmt-struct_lit_width: 100 +// Struct literal-style + +fn main() { + let lorem = Lorem { ipsum: dolor, sit: amet }; +} diff --git a/tests/target/configs-struct_variant_width-above.rs b/tests/target/configs-struct_variant_width-above.rs new file mode 100644 index 00000000000..1fefbda81d5 --- /dev/null +++ b/tests/target/configs-struct_variant_width-above.rs @@ -0,0 +1,11 @@ +// rustfmt-struct_variant_width: 10 +// Struct variant width + +enum Lorem { + Ipsum, + Dolor(bool), + Sit { + amet: Consectetur, + adipiscing: Elit, + }, +} diff --git a/tests/target/configs-struct_variant_width-below.rs b/tests/target/configs-struct_variant_width-below.rs new file mode 100644 index 00000000000..a16a57e19b8 --- /dev/null +++ b/tests/target/configs-struct_variant_width-below.rs @@ -0,0 +1,8 @@ +// rustfmt-struct_variant_width: 100 +// Struct variant width + +enum Lorem { + Ipsum, + Dolor(bool), + Sit { amet: Consectetur, adipiscing: Elit }, +} diff --git a/tests/target/configs-tab_spaces-2.rs b/tests/target/configs-tab_spaces-2.rs new file mode 100644 index 00000000000..73b593d8fe1 --- /dev/null +++ b/tests/target/configs-tab_spaces-2.rs @@ -0,0 +1,14 @@ +// rustfmt-tab_spaces: 2 +// rustfmt-max_width: 30 +// rustfmt-array_layout: Block +// Tab spaces + +fn lorem() { + let ipsum = dolor(); + let sit = vec![ + "amet", + "consectetur", + "adipiscing", + "elit.", + ]; +} diff --git a/tests/target/configs-tab_spaces-4.rs b/tests/target/configs-tab_spaces-4.rs new file mode 100644 index 00000000000..f4f6cd78d95 --- /dev/null +++ b/tests/target/configs-tab_spaces-4.rs @@ -0,0 +1,14 @@ +// rustfmt-tab_spaces: 4 +// rustfmt-max_width: 30 +// rustfmt-array_layout: Block +// Tab spaces + +fn lorem() { + let ipsum = dolor(); + let sit = vec![ + "amet", + "consectetur", + "adipiscing", + "elit.", + ]; +} diff --git a/tests/target/configs-trailing_comma-always.rs b/tests/target/configs-trailing_comma-always.rs new file mode 100644 index 00000000000..951dc680912 --- /dev/null +++ b/tests/target/configs-trailing_comma-always.rs @@ -0,0 +1,14 @@ +// rustfmt-trailing_comma: Always +// Trailing comma + +fn main() { + let Lorem { ipsum, dolor, sit, } = amet; + let Lorem { + ipsum, + dolor, + sit, + amet, + consectetur, + adipiscing, + } = elit; +} diff --git a/tests/target/configs-trailing_comma-never.rs b/tests/target/configs-trailing_comma-never.rs new file mode 100644 index 00000000000..ca2da9136c7 --- /dev/null +++ b/tests/target/configs-trailing_comma-never.rs @@ -0,0 +1,14 @@ +// rustfmt-trailing_comma: Never +// Trailing comma + +fn main() { + let Lorem { ipsum, dolor, sit } = amet; + let Lorem { + ipsum, + dolor, + sit, + amet, + consectetur, + adipiscing + } = elit; +} diff --git a/tests/target/configs-trailing_comma-vertical.rs b/tests/target/configs-trailing_comma-vertical.rs new file mode 100644 index 00000000000..7283cde8d06 --- /dev/null +++ b/tests/target/configs-trailing_comma-vertical.rs @@ -0,0 +1,14 @@ +// rustfmt-trailing_comma: Vertical +// Trailing comma + +fn main() { + let Lorem { ipsum, dolor, sit } = amet; + let Lorem { + ipsum, + dolor, + sit, + amet, + consectetur, + adipiscing, + } = elit; +} diff --git a/tests/target/configs-type_punctuation_density-compressed.rs b/tests/target/configs-type_punctuation_density-compressed.rs new file mode 100644 index 00000000000..b05c353dc44 --- /dev/null +++ b/tests/target/configs-type_punctuation_density-compressed.rs @@ -0,0 +1,7 @@ +// rustfmt-type_punctuation_density: Compressed +// Type punctuation density + +// FIXME: remove whitespace around `+`: +fn lorem() { + // body +} diff --git a/tests/target/configs-type_punctuation_density-wide.rs b/tests/target/configs-type_punctuation_density-wide.rs new file mode 100644 index 00000000000..8909036e688 --- /dev/null +++ b/tests/target/configs-type_punctuation_density-wide.rs @@ -0,0 +1,6 @@ +// rustfmt-type_punctuation_density: Wide +// Type punctuation density + +fn lorem() { + // body +} diff --git a/tests/target/configs-use_try_shorthand-false.rs b/tests/target/configs-use_try_shorthand-false.rs new file mode 100644 index 00000000000..de7f8b4a5e2 --- /dev/null +++ b/tests/target/configs-use_try_shorthand-false.rs @@ -0,0 +1,6 @@ +// rustfmt-use_try_shorthand: false +// Use try! shorthand + +fn main() { + let lorem = try!(ipsum.map(|dolor| dolor.sit())); +} diff --git a/tests/target/configs-use_try_shorthand-true.rs b/tests/target/configs-use_try_shorthand-true.rs new file mode 100644 index 00000000000..d3aa035792c --- /dev/null +++ b/tests/target/configs-use_try_shorthand-true.rs @@ -0,0 +1,6 @@ +// rustfmt-use_try_shorthand: true +// Use try! shorthand + +fn main() { + let lorem = ipsum.map(|dolor| dolor.sit())?; +} diff --git a/tests/target/configs-where_density-compressed.rs b/tests/target/configs-where_density-compressed.rs new file mode 100644 index 00000000000..d10c860db07 --- /dev/null +++ b/tests/target/configs-where_density-compressed.rs @@ -0,0 +1,10 @@ +// rustfmt-where_density: Compressed +// Where density + +trait Lorem { + fn ipsum(dolor: Dolor) -> Sit where Dolor: Eq; + + fn ipsum(dolor: Dolor) -> Sit where Dolor: Eq { + // body + } +} diff --git a/tests/target/configs-where_density-compressed_if_empty.rs b/tests/target/configs-where_density-compressed_if_empty.rs new file mode 100644 index 00000000000..101a1c92575 --- /dev/null +++ b/tests/target/configs-where_density-compressed_if_empty.rs @@ -0,0 +1,12 @@ +// rustfmt-where_density: CompressedIfEmpty +// Where density + +trait Lorem { + fn ipsum(dolor: Dolor) -> Sit where Dolor: Eq; + + fn ipsum(dolor: Dolor) -> Sit + where Dolor: Eq + { + // body + } +} diff --git a/tests/target/configs-where_density-tall.rs b/tests/target/configs-where_density-tall.rs new file mode 100644 index 00000000000..cdf84f37f5c --- /dev/null +++ b/tests/target/configs-where_density-tall.rs @@ -0,0 +1,13 @@ +// rustfmt-where_density: Tall +// Where density + +trait Lorem { + fn ipsum(dolor: Dolor) -> Sit + where Dolor: Eq; + + fn ipsum(dolor: Dolor) -> Sit + where Dolor: Eq + { + // body + } +} diff --git a/tests/target/configs-where_density-vertical.rs b/tests/target/configs-where_density-vertical.rs new file mode 100644 index 00000000000..9fb9837710a --- /dev/null +++ b/tests/target/configs-where_density-vertical.rs @@ -0,0 +1,13 @@ +// rustfmt-where_density: Vertical +// Where density + +trait Lorem { + fn ipsum(dolor: Dolor) -> Sit + where Dolor: Eq; + + fn ipsum(dolor: Dolor) -> Sit + where Dolor: Eq + { + // body + } +} diff --git a/tests/target/configs-where_layout-horizontal.rs b/tests/target/configs-where_layout-horizontal.rs new file mode 100644 index 00000000000..5778c0c66e5 --- /dev/null +++ b/tests/target/configs-where_layout-horizontal.rs @@ -0,0 +1,15 @@ +// rustfmt-where_layout: Horizontal +// rustfmt-error_on_line_overflow: false +// Where layout + +fn lorem(ipsum: Ipsum, dolor: Dolor) + where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur +{ + // body +} + +fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) + where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur, Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit +{ + // body +} diff --git a/tests/target/configs-where_layout-horizontal_vertical.rs b/tests/target/configs-where_layout-horizontal_vertical.rs new file mode 100644 index 00000000000..8906056caa9 --- /dev/null +++ b/tests/target/configs-where_layout-horizontal_vertical.rs @@ -0,0 +1,17 @@ +// rustfmt-where_layout: HorizontalVertical +// Where layout + +fn lorem(ipsum: Ipsum, dolor: Dolor) + where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur +{ + // body +} + +fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) + where Ipsum: IpsumDolorSitAmet, + Dolor: DolorSitAmetConsectetur, + Sit: SitAmetConsecteturAdipiscing, + Amet: AmetConsecteturAdipiscingElit +{ + // body +} diff --git a/tests/target/configs-where_layout-mixed.rs b/tests/target/configs-where_layout-mixed.rs new file mode 100644 index 00000000000..636e42ac6ac --- /dev/null +++ b/tests/target/configs-where_layout-mixed.rs @@ -0,0 +1,15 @@ +// rustfmt-where_layout: Mixed +// Where layout + +fn lorem(ipsum: Ipsum, dolor: Dolor) + where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur +{ + // body +} + +fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) + where Ipsum: IpsumDolorSitAmet, Dolor: DolorSitAmetConsectetur, + Sit: SitAmetConsecteturAdipiscing, Amet: AmetConsecteturAdipiscingElit +{ + // body +} diff --git a/tests/target/configs-where_layout-vertical.rs b/tests/target/configs-where_layout-vertical.rs new file mode 100644 index 00000000000..9efe0cf04b8 --- /dev/null +++ b/tests/target/configs-where_layout-vertical.rs @@ -0,0 +1,18 @@ +// rustfmt-where_layout: Vertical +// Where layout + +fn lorem(ipsum: Ipsum, dolor: Dolor) + where Ipsum: IpsumDolorSitAmet, + Dolor: DolorSitAmetConsectetur +{ + // body +} + +fn lorem(ipsum: Ipsum, dolor: Dolor, sit: Sit, amet: Amet) + where Ipsum: IpsumDolorSitAmet, + Dolor: DolorSitAmetConsectetur, + Sit: SitAmetConsecteturAdipiscing, + Amet: AmetConsecteturAdipiscingElit +{ + // body +} diff --git a/tests/target/configs-where_pred_indent-block.rs b/tests/target/configs-where_pred_indent-block.rs new file mode 100644 index 00000000000..7df9a3e7c22 --- /dev/null +++ b/tests/target/configs-where_pred_indent-block.rs @@ -0,0 +1,11 @@ +// rustfmt-where_pred_indent: Block +// Where predicate indent + +fn lorem() -> T + where Ipsum: Eq, + Dolor: Eq, + Sit: Eq, + Amet: Eq +{ + // body +} diff --git a/tests/target/configs-where_pred_indent-visual.rs b/tests/target/configs-where_pred_indent-visual.rs new file mode 100644 index 00000000000..5136470372e --- /dev/null +++ b/tests/target/configs-where_pred_indent-visual.rs @@ -0,0 +1,11 @@ +// rustfmt-where_pred_indent: Visual +// Where predicate indent + +fn lorem() -> T + where Ipsum: Eq, + Dolor: Eq, + Sit: Eq, + Amet: Eq +{ + // body +} diff --git a/tests/target/configs-where_style-default.rs b/tests/target/configs-where_style-default.rs new file mode 100644 index 00000000000..3e1a3c93dfe --- /dev/null +++ b/tests/target/configs-where_style-default.rs @@ -0,0 +1,11 @@ +// rustfmt-where_style: Default +// Where style + +fn lorem() -> T + where Ipsum: Eq, + Dolor: Eq, + Sit: Eq, + Amet: Eq +{ + // body +} diff --git a/tests/target/configs-where_style-rfc.rs b/tests/target/configs-where_style-rfc.rs new file mode 100644 index 00000000000..0d5fe5ca51e --- /dev/null +++ b/tests/target/configs-where_style-rfc.rs @@ -0,0 +1,12 @@ +// rustfmt-where_style: Rfc +// Where style + +fn lorem() -> T +where + Ipsum: Eq, + Dolor: Eq, + Sit: Eq, + Amet: Eq, +{ + // body +} diff --git a/tests/target/configs-wrap_comments-false.rs b/tests/target/configs-wrap_comments-false.rs new file mode 100644 index 00000000000..48ecd88accb --- /dev/null +++ b/tests/target/configs-wrap_comments-false.rs @@ -0,0 +1,8 @@ +// rustfmt-wrap_comments: false +// rustfmt-max_width: 50 +// rustfmt-error_on_line_overflow: false +// Wrap comments + +fn main() { + // Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. +} diff --git a/tests/target/configs-wrap_comments-true.rs b/tests/target/configs-wrap_comments-true.rs new file mode 100644 index 00000000000..01e86123525 --- /dev/null +++ b/tests/target/configs-wrap_comments-true.rs @@ -0,0 +1,12 @@ +// rustfmt-wrap_comments: true +// rustfmt-max_width: 50 +// Wrap comments + +fn main() { + // Lorem ipsum dolor sit amet, consectetur + // adipiscing elit, sed do eiusmod tempor + // incididunt ut labore et dolore magna + // aliqua. Ut enim ad minim veniam, quis + // nostrud exercitation ullamco laboris nisi + // ut aliquip ex ea commodo consequat. +} diff --git a/tests/target/configs-wrap_match_arms-false.rs b/tests/target/configs-wrap_match_arms-false.rs new file mode 100644 index 00000000000..5d0337a0c7d --- /dev/null +++ b/tests/target/configs-wrap_match_arms-false.rs @@ -0,0 +1,14 @@ +// rustfmt-wrap_match_arms: false +// Wrap match-arms + +fn main() { + match lorem { + true => { + let ipsum = dolor; + println!("{:?}", ipsum); + } + false => { + println!("{}", sit) + } + } +} diff --git a/tests/target/configs-wrap_match_arms-true.rs b/tests/target/configs-wrap_match_arms-true.rs new file mode 100644 index 00000000000..3655a62f618 --- /dev/null +++ b/tests/target/configs-wrap_match_arms-true.rs @@ -0,0 +1,12 @@ +// rustfmt-wrap_match_arms: true +// Wrap match-arms + +fn main() { + match lorem { + true => { + let ipsum = dolor; + println!("{}", ipsum); + } + false => println!("{}", sit), + } +}