diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-06-12 13:41:52 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2020-06-12 13:41:52 +0100 |
commit | 1906655070f943f70d21fdbe54227d9b4521096b (patch) | |
tree | b89532a49e60e7d3f07bd07f684bd0e1eae06519 /crates/ra_syntax/src/ast | |
parent | 08a58901e8deee22a541ed14f7e6b02e3c57132e (diff) | |
parent | 4fefc7d06c8da093e783852c5f0d3aea31e2c939 (diff) |
Merge #4856
4856: Simplify r=matklad a=Veetaha
Co-authored-by: Veetaha <[email protected]>
Diffstat (limited to 'crates/ra_syntax/src/ast')
-rw-r--r-- | crates/ra_syntax/src/ast/tokens.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/crates/ra_syntax/src/ast/tokens.rs b/crates/ra_syntax/src/ast/tokens.rs index 56378385a..2e72d4927 100644 --- a/crates/ra_syntax/src/ast/tokens.rs +++ b/crates/ra_syntax/src/ast/tokens.rs | |||
@@ -84,7 +84,7 @@ impl Whitespace { | |||
84 | } | 84 | } |
85 | 85 | ||
86 | pub struct QuoteOffsets { | 86 | pub struct QuoteOffsets { |
87 | pub quotes: [TextRange; 2], | 87 | pub quotes: (TextRange, TextRange), |
88 | pub contents: TextRange, | 88 | pub contents: TextRange, |
89 | } | 89 | } |
90 | 90 | ||
@@ -103,7 +103,7 @@ impl QuoteOffsets { | |||
103 | let end = TextSize::of(literal); | 103 | let end = TextSize::of(literal); |
104 | 104 | ||
105 | let res = QuoteOffsets { | 105 | let res = QuoteOffsets { |
106 | quotes: [TextRange::new(start, left_quote), TextRange::new(right_quote, end)], | 106 | quotes: (TextRange::new(start, left_quote), TextRange::new(right_quote, end)), |
107 | contents: TextRange::new(left_quote, right_quote), | 107 | contents: TextRange::new(left_quote, right_quote), |
108 | }; | 108 | }; |
109 | Some(res) | 109 | Some(res) |
@@ -116,17 +116,17 @@ pub trait HasQuotes: AstToken { | |||
116 | let offsets = QuoteOffsets::new(text)?; | 116 | let offsets = QuoteOffsets::new(text)?; |
117 | let o = self.syntax().text_range().start(); | 117 | let o = self.syntax().text_range().start(); |
118 | let offsets = QuoteOffsets { | 118 | let offsets = QuoteOffsets { |
119 | quotes: [offsets.quotes[0] + o, offsets.quotes[1] + o], | 119 | quotes: (offsets.quotes.0 + o, offsets.quotes.1 + o), |
120 | contents: offsets.contents + o, | 120 | contents: offsets.contents + o, |
121 | }; | 121 | }; |
122 | Some(offsets) | 122 | Some(offsets) |
123 | } | 123 | } |
124 | fn open_quote_text_range(&self) -> Option<TextRange> { | 124 | fn open_quote_text_range(&self) -> Option<TextRange> { |
125 | self.quote_offsets().map(|it| it.quotes[0]) | 125 | self.quote_offsets().map(|it| it.quotes.0) |
126 | } | 126 | } |
127 | 127 | ||
128 | fn close_quote_text_range(&self) -> Option<TextRange> { | 128 | fn close_quote_text_range(&self) -> Option<TextRange> { |
129 | self.quote_offsets().map(|it| it.quotes[1]) | 129 | self.quote_offsets().map(|it| it.quotes.1) |
130 | } | 130 | } |
131 | 131 | ||
132 | fn text_range_between_quotes(&self) -> Option<TextRange> { | 132 | fn text_range_between_quotes(&self) -> Option<TextRange> { |