aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_syntax/src/yellow
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2019-02-08 11:49:43 +0000
committerAleksey Kladov <[email protected]>2019-02-08 11:49:43 +0000
commit12e3b4c70b5ef23b2fdfc197296d483680e125f9 (patch)
tree71baa0e0a62f9f6b61450501c5f821f67badf9e4 /crates/ra_syntax/src/yellow
parent5cb1d41a30d25cbe136402644bf5434dd667f1e5 (diff)
reformat the world
Diffstat (limited to 'crates/ra_syntax/src/yellow')
-rw-r--r--crates/ra_syntax/src/yellow/builder.rs5
-rw-r--r--crates/ra_syntax/src/yellow/syntax_error.rs12
-rw-r--r--crates/ra_syntax/src/yellow/syntax_text.rs10
3 files changed, 7 insertions, 20 deletions
diff --git a/crates/ra_syntax/src/yellow/builder.rs b/crates/ra_syntax/src/yellow/builder.rs
index 37ae6329b..e8b9112d4 100644
--- a/crates/ra_syntax/src/yellow/builder.rs
+++ b/crates/ra_syntax/src/yellow/builder.rs
@@ -12,10 +12,7 @@ pub(crate) struct GreenBuilder {
12 12
13impl GreenBuilder { 13impl GreenBuilder {
14 pub(crate) fn new() -> GreenBuilder { 14 pub(crate) fn new() -> GreenBuilder {
15 GreenBuilder { 15 GreenBuilder { errors: Vec::new(), inner: GreenNodeBuilder::new() }
16 errors: Vec::new(),
17 inner: GreenNodeBuilder::new(),
18 }
19 } 16 }
20} 17}
21 18
diff --git a/crates/ra_syntax/src/yellow/syntax_error.rs b/crates/ra_syntax/src/yellow/syntax_error.rs
index c52c44cc3..412cf82cc 100644
--- a/crates/ra_syntax/src/yellow/syntax_error.rs
+++ b/crates/ra_syntax/src/yellow/syntax_error.rs
@@ -28,10 +28,7 @@ impl Into<Location> for TextRange {
28 28
29impl SyntaxError { 29impl SyntaxError {
30 pub fn new<L: Into<Location>>(kind: SyntaxErrorKind, loc: L) -> SyntaxError { 30 pub fn new<L: Into<Location>>(kind: SyntaxErrorKind, loc: L) -> SyntaxError {
31 SyntaxError { 31 SyntaxError { kind, location: loc.into() }
32 kind,
33 location: loc.into(),
34 }
35 } 32 }
36 33
37 pub fn kind(&self) -> SyntaxErrorKind { 34 pub fn kind(&self) -> SyntaxErrorKind {
@@ -119,10 +116,9 @@ impl fmt::Display for SyntaxErrorKind {
119 InvalidByteEscape => write!(f, "Invalid escape sequence"), 116 InvalidByteEscape => write!(f, "Invalid escape sequence"),
120 TooShortByteCodeEscape => write!(f, "Escape sequence should have two digits"), 117 TooShortByteCodeEscape => write!(f, "Escape sequence should have two digits"),
121 MalformedByteCodeEscape => write!(f, "Escape sequence should be a hexadecimal number"), 118 MalformedByteCodeEscape => write!(f, "Escape sequence should be a hexadecimal number"),
122 UnicodeEscapeForbidden => write!( 119 UnicodeEscapeForbidden => {
123 f, 120 write!(f, "Unicode escapes are not allowed in byte literals or byte strings")
124 "Unicode escapes are not allowed in byte literals or byte strings" 121 }
125 ),
126 TooShortAsciiCodeEscape => write!(f, "Escape sequence should have two digits"), 122 TooShortAsciiCodeEscape => write!(f, "Escape sequence should have two digits"),
127 AsciiCodeEscapeOutOfRange => { 123 AsciiCodeEscapeOutOfRange => {
128 write!(f, "Escape sequence should be between \\x00 and \\x7F") 124 write!(f, "Escape sequence should be between \\x00 and \\x7F")
diff --git a/crates/ra_syntax/src/yellow/syntax_text.rs b/crates/ra_syntax/src/yellow/syntax_text.rs
index 378cd1b2e..84e5b231a 100644
--- a/crates/ra_syntax/src/yellow/syntax_text.rs
+++ b/crates/ra_syntax/src/yellow/syntax_text.rs
@@ -10,10 +10,7 @@ pub struct SyntaxText<'a> {
10 10
11impl<'a> SyntaxText<'a> { 11impl<'a> SyntaxText<'a> {
12 pub(crate) fn new(node: &'a SyntaxNode) -> SyntaxText<'a> { 12 pub(crate) fn new(node: &'a SyntaxNode) -> SyntaxText<'a> {
13 SyntaxText { 13 SyntaxText { node, range: node.range() }
14 node,
15 range: node.range(),
16 }
17 } 14 }
18 15
19 pub fn chunks(&self) -> impl Iterator<Item = &'a str> { 16 pub fn chunks(&self) -> impl Iterator<Item = &'a str> {
@@ -58,10 +55,7 @@ impl<'a> SyntaxText<'a> {
58 let range = range.restrict(self.range).unwrap_or_else(|| { 55 let range = range.restrict(self.range).unwrap_or_else(|| {
59 panic!("invalid slice, range: {:?}, slice: {:?}", self.range, range) 56 panic!("invalid slice, range: {:?}, slice: {:?}", self.range, range)
60 }); 57 });
61 SyntaxText { 58 SyntaxText { node: self.node, range }
62 node: self.node,
63 range,
64 }
65 } 59 }
66 60
67 pub fn char_at(&self, offset: impl Into<TextUnit>) -> Option<char> { 61 pub fn char_at(&self, offset: impl Into<TextUnit>) -> Option<char> {