Use slices directly instead of &Vec (#10328)

Simplifies the signature, makes it more flexible.
Detected a few unnecessary allocations in the process.
This commit is contained in:
Stefan Holderbach
2023-09-12 05:38:20 +02:00
committed by GitHub
parent 84c10de864
commit e90b099622
17 changed files with 48 additions and 46 deletions

View File

@ -19,10 +19,10 @@ pub fn get_columns(input: &[Value]) -> Vec<String> {
}
// If a column doesn't exist in the input, return it.
pub fn nonexistent_column(inputs: Vec<String>, columns: Vec<String>) -> Option<String> {
pub fn nonexistent_column(inputs: &[String], columns: &[String]) -> Option<String> {
let set: HashSet<String> = HashSet::from_iter(columns.iter().cloned());
for input in &inputs {
for input in inputs {
if set.contains(input) {
continue;
}