refactor: swap &Vec[T] with &[T] where appropriate
This commit is contained in:
parent
d14d898f11
commit
59be1edaa1
10 changed files with 17 additions and 23 deletions
|
|
@ -399,7 +399,7 @@ fn test_feature_corpus_files() {
|
|||
}
|
||||
|
||||
fn check_consistent_sizes(tree: &Tree, input: &[u8]) {
|
||||
fn check(node: Node, line_offsets: &Vec<usize>) {
|
||||
fn check(node: Node, line_offsets: &[usize]) {
|
||||
let start_byte = node.start_byte();
|
||||
let end_byte = node.end_byte();
|
||||
let start_point = node.start_position();
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ use std::str;
|
|||
|
||||
#[derive(Debug)]
|
||||
pub struct ReadRecorder<'a> {
|
||||
content: &'a Vec<u8>,
|
||||
content: &'a [u8],
|
||||
indices_read: Vec<usize>,
|
||||
}
|
||||
|
||||
impl<'a> ReadRecorder<'a> {
|
||||
#[must_use]
|
||||
pub const fn new(content: &'a Vec<u8>) -> Self {
|
||||
pub const fn new(content: &'a [u8]) -> Self {
|
||||
Self {
|
||||
content,
|
||||
indices_read: Vec::new(),
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue