rust/src
Yacin Tmimi f7c4a44149 Adjust non-empty tuple struct span to start before fields
Resolves 5011

Tuple structs with visibility modifiers and comments before the first
field were incorrectly formatted. Comments would duplicate part of the
visibility modifier and struct name.

When trying to parse the tuple fields the ``items::Context`` searches
for the opening '(', but because the visibility modifier introduces
another '(' -- for example ``pub(crate)`` -- the parsing gets messed up.

Now the span is adjusted to start after the struct identifier, or after
any generics. Adjusting the span in this way ensures that the
``items::Contex`` will correctly find the tuple fields.
2021-10-12 20:08:07 -05:00
..
attr Insert an empty line when normalizing #[doc = ""] 2019-05-22 00:10:46 +09:00
bin fix: make --edition 2021 visible in --help 2021-07-27 19:50:11 -05:00
cargo-fmt refactor: simplify local dep lookups 2021-09-23 21:12:57 -05:00
config Stabilize match_block_trailing_comma. (#4145) 2021-10-11 17:16:10 -05:00
emitter fix a bunch of clippy warnings 2021-07-25 22:53:32 -05:00
format-diff Fix some clippy warnings 2021-02-18 20:20:29 -06:00
formatting Support @generated marker to skip code formatting 2021-09-14 21:22:26 -05:00
git-rustfmt Fix some clippy warnings 2021-02-18 20:20:29 -06:00
modules deps: minor rustc_ast changes for v691 2020-11-28 17:41:21 -06:00
syntux Support @generated marker to skip code formatting 2021-09-14 21:22:26 -05:00
test Support @generated marker to skip code formatting 2021-09-14 21:22:26 -05:00
attr.rs Update derive attibute span to start after opening '(' 2021-10-05 22:29:23 -05:00
chains.rs fix a bunch of clippy warnings 2021-07-25 22:53:32 -05:00
closures.rs fix a bunch of clippy warnings 2021-07-25 22:53:32 -05:00
comment.rs rustfmt doc code blocks with multiple comma-separated attributes 2021-09-08 23:27:51 -05:00
coverage.rs Implement closing-block procedure without relying on missed_span module (#3691) 2019-07-17 23:07:12 +09:00
emitter.rs add json emit mode (#3735) 2019-08-16 11:14:53 +09:00
expr.rs Prevent structs with ".." from being rewritten with alignment 2021-10-12 19:37:48 -05:00
format_report_formatter.rs Upgrade annotate-snippets to 0.8 (#4762) 2021-04-22 08:33:36 -05:00
formatting.rs Support @generated marker to skip code formatting 2021-09-14 21:22:26 -05:00
ignore_path.rs
imports.rs Implement One option for imports_granularity (#4669) 2021-08-31 18:33:06 -05:00
issues.rs fix a bunch of clippy warnings 2021-07-25 22:53:32 -05:00
items.rs Adjust non-empty tuple struct span to start before fields 2021-10-12 20:08:07 -05:00
lib.rs chore: disable clippy::matches_like_macro lint 2021-07-25 22:53:32 -05:00
lists.rs fix a bunch of clippy warnings 2021-07-25 22:53:32 -05:00
macros.rs fix a bunch of clippy warnings 2021-07-25 22:53:32 -05:00
matches.rs Trailing comma on match block goes missing when guard is on its own line 2021-09-20 20:05:52 -05:00
missed_spans.rs fix: resolve idempotency issue in extern body elements 2021-09-07 20:22:09 -05:00
modules.rs fix(rustfmt): load nested out-of-line mods correctly 2021-06-17 22:35:19 -05:00
overflow.rs Wrap long array and slice patterns. 2021-10-04 20:41:17 -05:00
pairs.rs refactor: rename libsyntax --> rustc_ast 2020-03-27 22:29:12 -05:00
patterns.rs Wrap long array and slice patterns. 2021-10-04 20:41:17 -05:00
release_channel.rs
reorder.rs Implement One option for imports_granularity (#4669) 2021-08-31 18:33:06 -05:00
rewrite.rs feat: don't insert semi in macro_rules arm body 2020-11-11 18:26:13 -06:00
rustfmt_diff.rs fix a bunch of clippy warnings 2021-07-25 22:53:32 -05:00
shape.rs Allow overflowing rhs of unit variant (#3566) 2019-05-22 10:51:19 +09:00
skip.rs fix a bunch of clippy warnings 2021-07-25 22:53:32 -05:00
source_file.rs fix a bunch of clippy warnings 2021-07-25 22:53:32 -05:00
source_map.rs refactor: backport syntux mod 2020-03-26 21:25:34 -05:00
spanned.rs fix: use correct spans for params with attrs 2021-09-06 18:14:13 -05:00
stmt.rs Preserve comments in empty statements (#4180) 2020-10-24 11:13:00 -05:00
string.rs fix a bunch of clippy warnings 2021-07-25 22:53:32 -05:00
syntux.rs refactor: backport syntux mod 2020-03-26 21:25:34 -05:00
types.rs fix: don't drop drop generic args on assoc ty constraints 2021-08-08 13:58:10 -05:00
utils.rs fix a bunch of clippy warnings 2021-07-25 22:53:32 -05:00
vertical.rs deps: apply rustc-ap-* v712 changes 2021-04-02 23:21:06 -05:00
visitor.rs Preserve visibility on trait items inside trait and impl 2021-08-22 12:06:18 -05:00