mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
minor: improve readability
This commit is contained in:
parent
25adc5e9f0
commit
8009ccc27d
1 changed files with 14 additions and 10 deletions
|
@ -27,11 +27,7 @@ pub(super) fn opt_generic_arg_list(p: &mut Parser, colon_colon_required: bool) {
|
||||||
// type A = B<'static, i32, 1, { 2 }, Item=u64, true, false>;
|
// type A = B<'static, i32, 1, { 2 }, Item=u64, true, false>;
|
||||||
fn generic_arg(p: &mut Parser) {
|
fn generic_arg(p: &mut Parser) {
|
||||||
match p.current() {
|
match p.current() {
|
||||||
LIFETIME_IDENT => {
|
LIFETIME_IDENT => lifetime_arg(p),
|
||||||
let m = p.start();
|
|
||||||
lifetime(p);
|
|
||||||
m.complete(p, LIFETIME_ARG);
|
|
||||||
}
|
|
||||||
// test associated_type_bounds
|
// test associated_type_bounds
|
||||||
// fn print_all<T: Iterator<Item, Item::Item, Item::<true>, Item: Display, Item<'a> = Item>>(printables: T) {}
|
// fn print_all<T: Iterator<Item, Item::Item, Item::<true>, Item: Display, Item<'a> = Item>>(printables: T) {}
|
||||||
IDENT if [T![<], T![=], T![:]].contains(&p.nth(1)) => {
|
IDENT if [T![<], T![=], T![:]].contains(&p.nth(1)) => {
|
||||||
|
@ -83,14 +79,16 @@ fn generic_arg(p: &mut Parser) {
|
||||||
// fn f() { S::<-1> }
|
// fn f() { S::<-1> }
|
||||||
T!['{'] | T![true] | T![false] | T![-] => const_arg(p),
|
T!['{'] | T![true] | T![false] | T![-] => const_arg(p),
|
||||||
k if k.is_literal() => const_arg(p),
|
k if k.is_literal() => const_arg(p),
|
||||||
_ => {
|
_ => type_arg(p),
|
||||||
let m = p.start();
|
|
||||||
types::type_(p);
|
|
||||||
m.complete(p, TYPE_ARG);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn lifetime_arg(p: &mut Parser) {
|
||||||
|
let m = p.start();
|
||||||
|
lifetime(p);
|
||||||
|
m.complete(p, LIFETIME_ARG);
|
||||||
|
}
|
||||||
|
|
||||||
pub(super) fn const_arg(p: &mut Parser) {
|
pub(super) fn const_arg(p: &mut Parser) {
|
||||||
let m = p.start();
|
let m = p.start();
|
||||||
match p.current() {
|
match p.current() {
|
||||||
|
@ -121,3 +119,9 @@ pub(super) fn const_arg(p: &mut Parser) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn type_arg(p: &mut Parser) {
|
||||||
|
let m = p.start();
|
||||||
|
types::type_(p);
|
||||||
|
m.complete(p, TYPE_ARG);
|
||||||
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue