mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
Extract expr_with_attrs
This commit is contained in:
parent
90b8a31b83
commit
b7c45fba57
3 changed files with 36 additions and 23 deletions
|
@ -191,19 +191,8 @@ fn array_expr(p: &mut Parser) -> CompletedMarker {
|
|||
|
||||
// test array_attrs
|
||||
// const A: &[i64] = &[1, #[cfg(test)] 2];
|
||||
let m = p.start();
|
||||
let has_attrs = p.at(T![#]);
|
||||
attributes::outer_attributes(p);
|
||||
|
||||
let cm = expr(p).0;
|
||||
|
||||
match (has_attrs, cm) {
|
||||
(true, Some(cm)) => {
|
||||
let kind = cm.kind();
|
||||
cm.undo_completion(p).abandon(p);
|
||||
m.complete(p, kind);
|
||||
}
|
||||
_ => m.abandon(p),
|
||||
if !expr_with_attrs(p) {
|
||||
break;
|
||||
}
|
||||
|
||||
if n_exprs == 1 && p.eat(T![;]) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue