mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-16 23:36:13 +00:00
refactor: fix clippy lints
This commit is contained in:
parent
12e28c3575
commit
ebbbaaa90f
5 changed files with 50 additions and 54 deletions
|
@ -181,29 +181,27 @@ impl ast::TokenTree {
|
|||
let kind = t.kind();
|
||||
if kind.is_trivia() {
|
||||
was_joint = false
|
||||
} else if kind == SyntaxKind::IDENT {
|
||||
let token_text = t.text();
|
||||
let contextual_kw =
|
||||
SyntaxKind::from_contextual_keyword(token_text).unwrap_or(SyntaxKind::IDENT);
|
||||
parser_input.push_ident(contextual_kw);
|
||||
} else {
|
||||
if kind == SyntaxKind::IDENT {
|
||||
let token_text = t.text();
|
||||
let contextual_kw = SyntaxKind::from_contextual_keyword(token_text)
|
||||
.unwrap_or(SyntaxKind::IDENT);
|
||||
parser_input.push_ident(contextual_kw);
|
||||
} else {
|
||||
if was_joint {
|
||||
if was_joint {
|
||||
parser_input.was_joint();
|
||||
}
|
||||
parser_input.push(kind);
|
||||
// Tag the token as joint if it is float with a fractional part
|
||||
// we use this jointness to inform the parser about what token split
|
||||
// event to emit when we encounter a float literal in a field access
|
||||
if kind == SyntaxKind::FLOAT_NUMBER {
|
||||
if !t.text().ends_with('.') {
|
||||
parser_input.was_joint();
|
||||
}
|
||||
parser_input.push(kind);
|
||||
// Tag the token as joint if it is float with a fractional part
|
||||
// we use this jointness to inform the parser about what token split
|
||||
// event to emit when we encounter a float literal in a field access
|
||||
if kind == SyntaxKind::FLOAT_NUMBER {
|
||||
if !t.text().ends_with('.') {
|
||||
parser_input.was_joint();
|
||||
} else {
|
||||
was_joint = false;
|
||||
}
|
||||
} else {
|
||||
was_joint = true;
|
||||
was_joint = false;
|
||||
}
|
||||
} else {
|
||||
was_joint = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue