refactor: swap &Vec[T] with &[T] where appropriate

This commit is contained in:
Amaan Qureshi 2024-02-07 02:50:18 -05:00
parent d14d898f11
commit 59be1edaa1
No known key found for this signature in database
GPG key ID: E67890ADC4227273
10 changed files with 17 additions and 23 deletions

View file

@ -678,14 +678,11 @@ fn test_get_changed_ranges() {
}
}
fn index_of(text: &Vec<u8>, substring: &str) -> usize {
str::from_utf8(text.as_slice())
.unwrap()
.find(substring)
.unwrap()
fn index_of(text: &[u8], substring: &str) -> usize {
str::from_utf8(text).unwrap().find(substring).unwrap()
}
fn range_of(text: &Vec<u8>, substring: &str) -> Range {
fn range_of(text: &[u8], substring: &str) -> Range {
let start_byte = index_of(text, substring);
let end_byte = start_byte + substring.as_bytes().len();
Range {