-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
The parameter types of ParamValues::{get_placeholders_with_values,verify} could be changed to avoid expensive conversion on the caller side.
impl ParamValues {
pub fn verify(&self, expect: &Vec<DataType>) -> Result<()>;
}Receiving &[DataType] instead of &Vec<DataType> will allow the callers to pass an arbitrary slice without cloning it to a temporary Vec first. Clippy has a lint for this: ptr_arg
impl ParamValues {
pub fn get_placeholders_with_values(
&self,
id: &String,
data_type: &Option<DataType>,
) -> Result<ScalarValue>;
}&String -> &str: ptr_arg likewise.
Receiving Option<&DataType> instead of &Option<DataType> will allow the callers to avoid cloning when they only have &DataType at hand. If the callers have &Option<DataType>, they will have to call Option::as_ref, but the performance cost of this conversion is negligible. There's a work-in-progress Clippy lint for this: rust-lang/rust-clippy#11463
To Reproduce
No response
Expected behavior
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working