mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 06:25:43 +02:00
Make get_env_var
return a reference to a Value
(#13987)
# Description Title says it all, changes `EngineState::get_env_var` to return a `Option<&'a Value>` instead of an owned `Option<Value>`. This avoids some unnecessary clones. I also made a similar change to the `PluginExecutionContext` trait.
This commit is contained in:
@ -107,7 +107,7 @@ impl Command for Cd {
|
||||
// Set OLDPWD.
|
||||
// We're using `Stack::get_env_var()` instead of `EngineState::cwd()` to avoid a conversion roundtrip.
|
||||
if let Some(oldpwd) = stack.get_env_var(engine_state, "PWD") {
|
||||
stack.add_env_var("OLDPWD".into(), oldpwd)
|
||||
stack.add_env_var("OLDPWD".into(), oldpwd.clone())
|
||||
}
|
||||
|
||||
match have_permission(&path) {
|
||||
|
Reference in New Issue
Block a user