Make Call::get_flag_expr return Expression by ref (#11388)

# Description
A small refactor that eliminates some `Expression` cloning.

# User-Facing Changes
Breaking change for `nu_protocol`.
This commit is contained in:
Ian Manske
2023-12-21 15:42:07 +00:00
committed by GitHub
parent f8e63328d8
commit 6f384da57e
3 changed files with 14 additions and 14 deletions

View File

@ -164,10 +164,10 @@ impl Call {
false
}
pub fn get_flag_expr(&self, flag_name: &str) -> Option<Expression> {
pub fn get_flag_expr(&self, flag_name: &str) -> Option<&Expression> {
for name in self.named_iter() {
if flag_name == name.0.item {
return name.2.clone();
return name.2.as_ref();
}
}