mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-15 22:44:01 +00:00
Remove Arc from environment::globals() (take 2)
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. NB: This particular change was safe, and passes all tests on its own.
This commit is contained in:
parent
45e249dd94
commit
3d648e6e04
5 changed files with 7 additions and 7 deletions
|
@ -990,7 +990,7 @@ fn throwing_main() -> i32 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
OutputType::Ansi => {
|
OutputType::Ansi => {
|
||||||
colored_output = colorize(&output_wtext, &colors, &**EnvStack::globals());
|
colored_output = colorize(&output_wtext, &colors, EnvStack::globals());
|
||||||
}
|
}
|
||||||
OutputType::Html => {
|
OutputType::Html => {
|
||||||
colored_output = html_colorize(&output_wtext, &colors);
|
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
|
let path_to_load = completion_autoloader
|
||||||
.lock()
|
.lock()
|
||||||
.expect("mutex poisoned")
|
.expect("mutex poisoned")
|
||||||
.resolve_command(cmd, &**EnvStack::globals());
|
.resolve_command(cmd, EnvStack::globals());
|
||||||
if let Some(path_to_load) = path_to_load {
|
if let Some(path_to_load) = path_to_load {
|
||||||
Autoload::perform_autoload(&path_to_load, parser);
|
Autoload::perform_autoload(&path_to_load, parser);
|
||||||
completion_autoloader
|
completion_autoloader
|
||||||
|
|
6
src/env/environment.rs
vendored
6
src/env/environment.rs
vendored
|
@ -360,10 +360,10 @@ impl EnvStack {
|
||||||
|
|
||||||
/// A variable stack that only represents globals.
|
/// A variable stack that only represents globals.
|
||||||
/// Do not push or pop from this.
|
/// Do not push or pop from this.
|
||||||
pub fn globals() -> &'static Arc<EnvStack> {
|
pub fn globals() -> &'static EnvStack {
|
||||||
use std::sync::OnceLock;
|
use std::sync::OnceLock;
|
||||||
static GLOBALS: OnceLock<Arc<EnvStack>> = OnceLock::new();
|
static GLOBALS: OnceLock<EnvStack> = OnceLock::new();
|
||||||
&GLOBALS.get_or_init(|| Arc::new(EnvStack::new()))
|
GLOBALS.get_or_init(|| EnvStack::new())
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Access the principal variable stack, associated with the principal parser.
|
/// 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 funcset.allow_autoload(name) {
|
||||||
if let Some(path) = funcset
|
if let Some(path) = funcset
|
||||||
.autoloader
|
.autoloader
|
||||||
.resolve_command(name, &**EnvStack::globals())
|
.resolve_command(name, EnvStack::globals())
|
||||||
{
|
{
|
||||||
path_to_autoload = Some(path);
|
path_to_autoload = Some(path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -65,7 +65,7 @@ impl<'a> OperationContext<'a> {
|
||||||
// Return an operation context that contains only global variables, no parser, and never
|
// Return an operation context that contains only global variables, no parser, and never
|
||||||
// cancels.
|
// cancels.
|
||||||
pub fn globals() -> OperationContext<'static> {
|
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.
|
/// Construct from a full set of properties.
|
||||||
|
|
Loading…
Reference in a new issue