mirror of
https://github.com/Myriad-Dreamin/tinymist.git
synced 2025-11-23 12:46:43 +00:00
dev: drop if_chain and collapse if statements (#2097)
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
Some checks are pending
tinymist::auto_tag / auto-tag (push) Waiting to run
tinymist::ci / Duplicate Actions Detection (push) Waiting to run
tinymist::ci / Check Clippy, Formatting, Completion, Documentation, and Tests (Linux) (push) Waiting to run
tinymist::ci / Check Minimum Rust version and Tests (Windows) (push) Waiting to run
tinymist::ci / prepare-build (push) Waiting to run
tinymist::ci / announce (push) Blocked by required conditions
tinymist::ci / build (push) Blocked by required conditions
tinymist::gh_pages / build-gh-pages (push) Waiting to run
This commit is contained in:
parent
1c9db1ce69
commit
ce447185d1
42 changed files with 520 additions and 545 deletions
|
|
@ -349,18 +349,19 @@ impl Tokenizer {
|
|||
.map(|token_type| Token::new(token_type, modifiers, range.clone()));
|
||||
|
||||
// Push start
|
||||
if let Some(prev_token) = self.token.as_mut() {
|
||||
if !prev_token.range.is_empty() && prev_token.range.start < range.start {
|
||||
let end = prev_token.range.end.min(range.start);
|
||||
let sliced = Token {
|
||||
token_type: prev_token.token_type,
|
||||
modifiers: prev_token.modifiers,
|
||||
range: prev_token.range.start..end,
|
||||
};
|
||||
// Slice the previous token
|
||||
prev_token.range.start = end;
|
||||
self.push(sliced);
|
||||
}
|
||||
if let Some(prev_token) = self.token.as_mut()
|
||||
&& !prev_token.range.is_empty()
|
||||
&& prev_token.range.start < range.start
|
||||
{
|
||||
let end = prev_token.range.end.min(range.start);
|
||||
let sliced = Token {
|
||||
token_type: prev_token.token_type,
|
||||
modifiers: prev_token.modifiers,
|
||||
range: prev_token.range.start..end,
|
||||
};
|
||||
// Slice the previous token
|
||||
prev_token.range.start = end;
|
||||
self.push(sliced);
|
||||
}
|
||||
|
||||
if !is_leaf {
|
||||
|
|
@ -372,14 +373,14 @@ impl Tokenizer {
|
|||
}
|
||||
|
||||
// Push end
|
||||
if let Some(token) = token.clone() {
|
||||
if !token.range.is_empty() {
|
||||
// Slice the previous token
|
||||
if let Some(prev_token) = self.token.as_mut() {
|
||||
prev_token.range.start = token.range.end;
|
||||
}
|
||||
self.push(token);
|
||||
if let Some(token) = token.clone()
|
||||
&& !token.range.is_empty()
|
||||
{
|
||||
// Slice the previous token
|
||||
if let Some(prev_token) = self.token.as_mut() {
|
||||
prev_token.range.start = token.range.end;
|
||||
}
|
||||
self.push(token);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue