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