From 5e4f0353c8e85e3776861aa3ebcc14a8f491a153 Mon Sep 17 00:00:00 2001 From: Will Page Date: Wed, 1 Feb 2023 08:01:23 -0800 Subject: [PATCH] Re-adding LazyConfig::is_init for use in cwd changing code --- src/bin/cargo/cli.rs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/bin/cargo/cli.rs b/src/bin/cargo/cli.rs index 3053854d4c7b..592a13345f4c 100644 --- a/src/bin/cargo/cli.rs +++ b/src/bin/cargo/cli.rs @@ -497,6 +497,13 @@ impl LazyConfig { Self { config: None } } + /// Check whether the config is loaded + /// + /// This is useful for asserts in case the environment needs to be setup before loading + pub fn is_init(&self) -> bool { + self.config.is_some() + } + /// Get the config, loading it if needed /// /// On error, the process is terminated