mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
Use indices first and last instead of min-max
This commit is contained in:
parent
caed836e41
commit
b7ab079211
@ -139,9 +139,10 @@ fn extend_tokens_from_range(
|
|||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
// Compute the first and last token index in original_range
|
// The first and last token index in original_range
|
||||||
let first_idx = *indices.iter().min_by_key(|&&idx| all_tokens[idx].text_range().start())?;
|
// Note that the indices is sorted
|
||||||
let last_idx = *indices.iter().max_by_key(|&&idx| all_tokens[idx].text_range().end())?;
|
let first_idx = *indices.first()?;
|
||||||
|
let last_idx = *indices.last()?;
|
||||||
|
|
||||||
// compute original mapped token range
|
// compute original mapped token range
|
||||||
let expanded = {
|
let expanded = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user