From 66023f6243ca346c1820cfe4c4faa943b974020f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20=C5=BD=C3=A1dn=C3=ADk?= Date: Sun, 20 Aug 2023 23:02:52 +0300 Subject: [PATCH] Remove "let config" warning (#10068) If you have a `config` variable defined at some point after reading config files, Nushell would print ``` warning: use `$env.config = ...` instead of `let config = ...` ``` I think it's long enough since we've used `$env.config` that we can remove this. Furthermore, it should be printed during `let` parsing because you can end up with a `config` constant after importing a `config` module (that was my case). The warning thus can be misleading. --- src/config_files.rs | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/src/config_files.rs b/src/config_files.rs index 729740106f..3d9791bcdc 100644 --- a/src/config_files.rs +++ b/src/config_files.rs @@ -4,7 +4,7 @@ use nu_cli::read_plugin_file; use nu_cli::{eval_config_contents, eval_source}; use nu_path::canonicalize_with; use nu_protocol::engine::{EngineState, Stack, StateWorkingSet}; -use nu_protocol::{report_error, Span}; +use nu_protocol::report_error; use nu_protocol::{ParseError, PipelineData, Spanned}; use nu_utils::{get_default_config, get_default_env}; use std::fs::File; @@ -203,19 +203,6 @@ pub(crate) fn setup_config( if is_login_shell { read_loginshell_file(engine_state, stack); } - - // Give a warning if we see `$config` for a few releases - { - let working_set = StateWorkingSet::new(engine_state); - if let Some(var) = working_set - .find_variable(b"$config") - .and_then(|id| stack.get_var(id, Span::unknown()).ok()) - { - if var.as_record().is_ok() { - println!("warning: use `$env.config = ...` instead of `let config = ...`"); - } - } - } } pub(crate) fn set_config_path(