mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-07 18:21:16 -03:00
Remove Arc from environment::globals()
We don't forward this variable for storage in any structs, so there's no reason to go through an Arc instead of returning the `&'static EnvStack` directly.
This commit is contained in:
@@ -990,7 +990,7 @@ enum OutputType {
|
||||
}
|
||||
}
|
||||
OutputType::Ansi => {
|
||||
colored_output = colorize(&output_wtext, &colors, &**EnvStack::globals());
|
||||
colored_output = colorize(&output_wtext, &colors, EnvStack::globals());
|
||||
}
|
||||
OutputType::Html => {
|
||||
colored_output = html_colorize(&output_wtext, &colors);
|
||||
|
||||
@@ -2473,7 +2473,7 @@ pub fn complete_load(cmd: &wstr, parser: &Parser) -> bool {
|
||||
let path_to_load = completion_autoloader
|
||||
.lock()
|
||||
.expect("mutex poisoned")
|
||||
.resolve_command(cmd, &**EnvStack::globals());
|
||||
.resolve_command(cmd, EnvStack::globals());
|
||||
if let Some(path_to_load) = path_to_load {
|
||||
Autoload::perform_autoload(&path_to_load, parser);
|
||||
completion_autoloader
|
||||
|
||||
6
src/env/environment.rs
vendored
6
src/env/environment.rs
vendored
@@ -360,10 +360,10 @@ pub fn universal_sync(&self, always: bool) -> Vec<Event> {
|
||||
|
||||
/// A variable stack that only represents globals.
|
||||
/// Do not push or pop from this.
|
||||
pub fn globals() -> &'static Arc<EnvStack> {
|
||||
pub fn globals() -> &'static EnvStack {
|
||||
use std::sync::OnceLock;
|
||||
static GLOBALS: OnceLock<Arc<EnvStack>> = OnceLock::new();
|
||||
&GLOBALS.get_or_init(|| Arc::new(EnvStack::new()))
|
||||
static GLOBALS: OnceLock<EnvStack> = OnceLock::new();
|
||||
GLOBALS.get_or_init(|| EnvStack::new())
|
||||
}
|
||||
|
||||
/// Access the principal variable stack, associated with the principal parser.
|
||||
|
||||
@@ -122,7 +122,7 @@ pub fn load(name: &wstr, parser: &Parser) -> bool {
|
||||
if funcset.allow_autoload(name) {
|
||||
if let Some(path) = funcset
|
||||
.autoloader
|
||||
.resolve_command(name, &**EnvStack::globals())
|
||||
.resolve_command(name, EnvStack::globals())
|
||||
{
|
||||
path_to_autoload = Some(path);
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ pub fn empty() -> OperationContext<'static> {
|
||||
// Return an operation context that contains only global variables, no parser, and never
|
||||
// cancels.
|
||||
pub fn globals() -> OperationContext<'static> {
|
||||
OperationContext::background(&**EnvStack::globals(), EXPANSION_LIMIT_DEFAULT)
|
||||
OperationContext::background(EnvStack::globals(), EXPANSION_LIMIT_DEFAULT)
|
||||
}
|
||||
|
||||
/// Construct from a full set of properties.
|
||||
|
||||
Reference in New Issue
Block a user