Repository: starship/starship
File: src/modules/mod.rs (Rust)

Code before:
            "elixir" => elixir::module(context),
            "elm" => elm::module(context),
            "erlang" => erlang::module(context),
            "env_var" => {
                if let Some(config_table) = context.config.get_env_var_modules() {
                    let mut env_modules = config_table
                        .iter()
                        .filter(|(_, config)| config.is_table())
                        .filter_map(|(variable, _)| {
                            env_var::module(vec!["env_var", variable], context)
                        })
                        .collect::<Vec<Module>>();
                    // Old configuration is present in starship configuration, notify user about change
                    if config_table.iter().any(|(_, config)| !config.is_table()) {
                        log::warn!("env_var module configuration has changed. Please update your configuration. https://starship.rs/config/#environment-variable");
                        if let Some(fallback_env_var_module) =
                            env_var::module(vec!["env_var"], context)
                        {
                            env_modules.push(fallback_env_var_module);
                        }
                    }
                    env_var::env_var_displayer(env_modules, context)
                } else {
                    None
                }
            }
            "gcloud" => gcloud::module(context),
            "git_branch" => git_branch::module(context),
            "git_commit" => git_commit::module(context),
            "git_state" => git_state::module(context),
            "git_status" => git_status::module(context),
            "golang" => golang::module(context),
            "helm" => helm::module(context),
            "hg_branch" => hg_branch::module(context),
            "hostname" => hostname::module(context),
            "java" => java::module(context),
            "jobs" => jobs::module(context),
            "julia" => julia::module(context),
            "kotlin" => kotlin::module(context),
            "kubernetes" => kubernetes::module(context),
            "line_break" => line_break::module(context),
            "lua" => lua::module(context),
            "memory_usage" => memory_usage::module(context),
            "nim" => nim::module(context),
            "nix_shell" => nix_shell::module(context),
            "nodejs" => nodejs::module(context),
            "ocaml" => ocaml::module(context),
            "openstack" => openstack::module(context),
            "package" => package::module(context),
            "perl" => perl::module(context),
            "php" => php::module(context),

Review comment (suggestion):
In an effort to unify the env_var module logic to one place, I think it would be best if this was contained in a function called from `src/modules/env_var.rs`, similarly to the rest of the modules in this match statement.

Code after:
            "dotnet" => dotnet::module(context),
            "elixir" => elixir::module(context),
            "elm" => elm::module(context),
            "erlang" => erlang::module(context),
            "env_var" => env_var::module(context),
            "gcloud" => gcloud::module(context),
            "git_branch" => git_branch::module(context),
            "git_commit" => git_commit::module(context),
            "git_metrics" => git_metrics::module(context),
            "git_state" => git_state::module(context),
            "git_status" => git_status::module(context),
            "golang" => golang::module(context),
            "helm" => helm::module(context),
            "hg_branch" => hg_branch::module(context),
            "hostname" => hostname::module(context),
            "java" => java::module(context),
            "jobs" => jobs::module(context),
            "julia" => julia::module(context),
            "kotlin" => kotlin::module(context),
            "kubernetes" => kubernetes::module(context),
            "line_break" => line_break::module(context),
            "lua" => lua::module(context),
            "memory_usage" => memory_usage::module(context),
            "nim" => nim::module(context),
            "nix_shell" => nix_shell::module(context),
            "nodejs" => nodejs::module(context),
            "ocaml" => ocaml::module(context),
            "openstack" => openstack::module(context),
            "package" => package::module(context),
            "perl" => perl::module(context),
            "php" => php::module(context),
            "purescript" => purescript::module(context),
            "python" => python::module(context),
            "rlang" => rlang::module(context),
            "red" => red::module(context),
            "ruby" => ruby::module(context),
            "rust" => rust::module(context),
            "scala" => scala::module(context),
            "shell" => shell::module(context),
            "shlvl" => shlvl::module(context),
            "singularity" => singularity::module(context),
            "swift" => swift::module(context),
            "status" => status::module(context),
            "terraform" => terraform::module(context),
            "time" => time::module(context),
            "crystal" => crystal::module(context),
            "username" => username::module(context),
            "vlang" => vlang::module(context),
            "vagrant" => vagrant::module(context),
            "vcsh" => vcsh::module(context),
            "zig" => zig::module(context),