From 4fefc7d06c8da093e783852c5f0d3aea31e2c939 Mon Sep 17 00:00:00 2001 From: Veetaha Date: Fri, 12 Jun 2020 02:06:28 +0300 Subject: Simplify --- crates/ra_syntax/src/ast/tokens.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crates') 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 { } pub struct QuoteOffsets { - pub quotes: [TextRange; 2], + pub quotes: (TextRange, TextRange), pub contents: TextRange, } @@ -103,7 +103,7 @@ impl QuoteOffsets { let end = TextSize::of(literal); let res = QuoteOffsets { - quotes: [TextRange::new(start, left_quote), TextRange::new(right_quote, end)], + quotes: (TextRange::new(start, left_quote), TextRange::new(right_quote, end)), contents: TextRange::new(left_quote, right_quote), }; Some(res) @@ -116,17 +116,17 @@ pub trait HasQuotes: AstToken { let offsets = QuoteOffsets::new(text)?; let o = self.syntax().text_range().start(); let offsets = QuoteOffsets { - quotes: [offsets.quotes[0] + o, offsets.quotes[1] + o], + quotes: (offsets.quotes.0 + o, offsets.quotes.1 + o), contents: offsets.contents + o, }; Some(offsets) } fn open_quote_text_range(&self) -> Option { - self.quote_offsets().map(|it| it.quotes[0]) + self.quote_offsets().map(|it| it.quotes.0) } fn close_quote_text_range(&self) -> Option { - self.quote_offsets().map(|it| it.quotes[1]) + self.quote_offsets().map(|it| it.quotes.1) } fn text_range_between_quotes(&self) -> Option { -- cgit v1.2.3