mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 04:53:34 +00:00
Formatting
This commit is contained in:
parent
59087840f5
commit
f356628ad8
5 changed files with 8 additions and 14 deletions
|
@ -140,9 +140,7 @@ pub(super) fn to_file(text: String, tokens: &[Token], events: Vec<Event>) -> Fil
|
||||||
}
|
}
|
||||||
builder.leaf(kind, len);
|
builder.leaf(kind, len);
|
||||||
}
|
}
|
||||||
&Event::Error { ref msg } => builder.error(ErrorMsg {
|
&Event::Error { ref msg } => builder.error(ErrorMsg { msg: msg.clone() }),
|
||||||
msg: msg.clone(),
|
|
||||||
}),
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
builder.finish()
|
builder.finish()
|
||||||
|
|
|
@ -94,7 +94,7 @@ fn item(p: &mut Parser) {
|
||||||
|
|
||||||
// test unsafe_auto_trait
|
// test unsafe_auto_trait
|
||||||
// unsafe auto trait T {}
|
// unsafe auto trait T {}
|
||||||
IDENT if p.at_kw("auto") && la == TRAIT_KW => {
|
IDENT if p.at_contextual_kw("auto") && la == TRAIT_KW => {
|
||||||
p.bump_remap(AUTO_KW);
|
p.bump_remap(AUTO_KW);
|
||||||
traits::trait_item(p);
|
traits::trait_item(p);
|
||||||
TRAIT_ITEM
|
TRAIT_ITEM
|
||||||
|
@ -109,7 +109,7 @@ fn item(p: &mut Parser) {
|
||||||
|
|
||||||
// test unsafe_default_impl
|
// test unsafe_default_impl
|
||||||
// unsafe default impl Foo {}
|
// unsafe default impl Foo {}
|
||||||
IDENT if p.at_kw("default") && la == IMPL_KW => {
|
IDENT if p.at_contextual_kw("default") && la == IMPL_KW => {
|
||||||
p.bump_remap(DEFAULT_KW);
|
p.bump_remap(DEFAULT_KW);
|
||||||
traits::impl_item(p);
|
traits::impl_item(p);
|
||||||
IMPL_ITEM
|
IMPL_ITEM
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
use parser::input::{ParserInput, InputPosition};
|
use parser::input::{InputPosition, ParserInput};
|
||||||
use parser::event::Event;
|
use parser::event::Event;
|
||||||
|
|
||||||
use SyntaxKind;
|
use SyntaxKind;
|
||||||
use syntax_kinds::{TOMBSTONE, EOF};
|
use syntax_kinds::{EOF, TOMBSTONE};
|
||||||
|
|
||||||
/// Implementation details of `Parser`, extracted
|
/// Implementation details of `Parser`, extracted
|
||||||
/// to a separate struct in order not to pollute
|
/// to a separate struct in order not to pollute
|
||||||
|
@ -29,7 +29,6 @@ impl<'t> ParserImpl<'t> {
|
||||||
self.events
|
self.events
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub(super) fn nth(&self, n: u32) -> SyntaxKind {
|
pub(super) fn nth(&self, n: u32) -> SyntaxKind {
|
||||||
self.inp.kind(self.pos + n)
|
self.inp.kind(self.pos + n)
|
||||||
}
|
}
|
||||||
|
@ -92,9 +91,9 @@ impl<'t> ParserImpl<'t> {
|
||||||
if idx == self.events.len() - 1 {
|
if idx == self.events.len() - 1 {
|
||||||
match self.events.pop() {
|
match self.events.pop() {
|
||||||
Some(Event::Start {
|
Some(Event::Start {
|
||||||
kind: TOMBSTONE,
|
kind: TOMBSTONE,
|
||||||
forward_parent: None,
|
forward_parent: None,
|
||||||
}) => (),
|
}) => (),
|
||||||
_ => unreachable!(),
|
_ => unreachable!(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,7 +113,6 @@ impl<'t> ParserImpl<'t> {
|
||||||
new_pos
|
new_pos
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn event(&mut self, event: Event) {
|
fn event(&mut self, event: Event) {
|
||||||
self.events.push(event)
|
self.events.push(event)
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,6 @@ impl Drop for Marker {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
pub(crate) struct CompletedMarker(u32);
|
pub(crate) struct CompletedMarker(u32);
|
||||||
|
|
||||||
impl CompletedMarker {
|
impl CompletedMarker {
|
||||||
|
|
|
@ -22,4 +22,3 @@ macro_rules! token_set {
|
||||||
token_set!($($t),*)
|
token_set!($($t),*)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue