mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 11:59:49 +00:00
Remove some allocations
This commit is contained in:
parent
c81aa68afe
commit
1bbc255ec5
13 changed files with 78 additions and 58 deletions
|
@ -193,6 +193,11 @@ where
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns all final segments of the argument, longest first.
|
||||
pub fn slice_tails<T>(this: &[T]) -> impl Iterator<Item = &[T]> {
|
||||
(0..this.len()).map(|i| &this[i..])
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue