mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-14 14:25:12 +00:00
cargo format
This commit is contained in:
parent
fda8ddc5fe
commit
59405bfe4a
2 changed files with 9 additions and 5 deletions
|
@ -162,9 +162,10 @@ impl<'a, S: Sink> EventProcessor<'a, S> {
|
||||||
.sum::<TextUnit>();
|
.sum::<TextUnit>();
|
||||||
self.leaf(kind, len, n_raw_tokens);
|
self.leaf(kind, len, n_raw_tokens);
|
||||||
}
|
}
|
||||||
Event::Error { msg } => self.sink.error(
|
Event::Error { msg } => self.sink.error(SyntaxError::new(
|
||||||
SyntaxError::new(SyntaxErrorKind::ParseError(msg), self.text_pos),
|
SyntaxErrorKind::ParseError(msg),
|
||||||
),
|
self.text_pos,
|
||||||
|
)),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
self.sink
|
self.sink
|
||||||
|
|
|
@ -28,7 +28,10 @@ impl Into<Location> for TextRange {
|
||||||
|
|
||||||
impl SyntaxError {
|
impl SyntaxError {
|
||||||
pub fn new<L: Into<Location>>(kind: SyntaxErrorKind, loc: L) -> SyntaxError {
|
pub fn new<L: Into<Location>>(kind: SyntaxErrorKind, loc: L) -> SyntaxError {
|
||||||
SyntaxError { kind, location: loc.into() }
|
SyntaxError {
|
||||||
|
kind,
|
||||||
|
location: loc.into(),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn location(&self) -> Location {
|
pub fn location(&self) -> Location {
|
||||||
|
@ -45,7 +48,7 @@ impl SyntaxError {
|
||||||
pub fn add_offset(mut self, plus_offset: TextUnit) -> SyntaxError {
|
pub fn add_offset(mut self, plus_offset: TextUnit) -> SyntaxError {
|
||||||
self.location = match self.location {
|
self.location = match self.location {
|
||||||
Location::Range(range) => Location::Range(range + plus_offset),
|
Location::Range(range) => Location::Range(range + plus_offset),
|
||||||
Location::Offset(offset) => Location::Offset(offset + plus_offset)
|
Location::Offset(offset) => Location::Offset(offset + plus_offset),
|
||||||
};
|
};
|
||||||
|
|
||||||
self
|
self
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue