mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-11-15 01:17:27 +00:00
test formatting
This commit is contained in:
parent
2510eaa9b2
commit
b0a104cbd1
3 changed files with 11 additions and 9 deletions
|
@ -20,7 +20,7 @@ use stdx::format_to;
|
|||
use syntax::{
|
||||
ast::{self, edit::IndentLevel},
|
||||
AstNode,
|
||||
SyntaxKind::{self, IDENT, LIFETIME_IDENT},
|
||||
SyntaxKind::{EOF, IDENT, LIFETIME_IDENT},
|
||||
SyntaxNode, T,
|
||||
};
|
||||
|
||||
|
@ -109,7 +109,7 @@ fn reindent(indent: IndentLevel, pp: String) -> String {
|
|||
|
||||
fn pretty_print_macro_expansion(expn: SyntaxNode) -> String {
|
||||
let mut res = String::new();
|
||||
let mut prev_kind = SyntaxKind::EOF;
|
||||
let mut prev_kind = EOF;
|
||||
let mut indent_level = 0;
|
||||
for token in iter::successors(expn.first_token(), |t| t.next_token()) {
|
||||
let curr_kind = token.kind();
|
||||
|
@ -129,6 +129,8 @@ fn pretty_print_macro_expansion(expn: SyntaxNode) -> String {
|
|||
(T![->], _) | (_, T![->]) => " ",
|
||||
(T![&&], _) | (_, T![&&]) => " ",
|
||||
(T![,], _) => " ",
|
||||
(T![fn], T!['(']) => "",
|
||||
_ if prev_kind.is_keyword() => " ",
|
||||
_ => "",
|
||||
};
|
||||
|
||||
|
|
|
@ -816,7 +816,7 @@ macro_rules! m {
|
|||
|
||||
fn bar() -> & 'a Baz<u8> {}
|
||||
|
||||
fn bar() -> extern"Rust"fn() -> Ret {}
|
||||
fn bar() -> extern "Rust"fn() -> Ret {}
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
@ -835,7 +835,7 @@ macro_rules! m {
|
|||
($p:pat) => { fn foo() { let $p; } }
|
||||
}
|
||||
fn foo() {
|
||||
let(a, b);
|
||||
let (a, b);
|
||||
}
|
||||
"#]],
|
||||
);
|
||||
|
|
|
@ -53,11 +53,11 @@ macro_rules! m {
|
|||
}
|
||||
}
|
||||
fn f() {
|
||||
let_ = 'c';
|
||||
let_ = 1000;
|
||||
let_ = 12E+99_f64;
|
||||
let_ = "rust1";
|
||||
let_ = -92;
|
||||
let _ = 'c';
|
||||
let _ = 1000;
|
||||
let _ = 12E+99_f64;
|
||||
let _ = "rust1";
|
||||
let _ = -92;
|
||||
}
|
||||
"#]],
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue