mirror of
https://github.com/nushell/nushell.git
synced 2024-11-23 00:43:33 +01:00
Remove unused code
This commit is contained in:
parent
a53368ccc8
commit
a9469743bc
@ -4,7 +4,6 @@ use std::fmt::Debug;
|
||||
pub trait Conf: Debug + Send {
|
||||
fn env(&self) -> Option<Value>;
|
||||
fn path(&self) -> Option<Value>;
|
||||
fn nu_env_dirs(&self) -> Option<Value>;
|
||||
fn reload(&self);
|
||||
}
|
||||
|
||||
@ -13,10 +12,6 @@ impl Conf for Box<dyn Conf> {
|
||||
(**self).env()
|
||||
}
|
||||
|
||||
fn nu_env_dirs(&self) -> Option<Value> {
|
||||
(**self).nu_env_dirs()
|
||||
}
|
||||
|
||||
fn path(&self) -> Option<Value> {
|
||||
(**self).path()
|
||||
}
|
||||
|
@ -20,10 +20,6 @@ impl Conf for NuConfig {
|
||||
self.path()
|
||||
}
|
||||
|
||||
fn nu_env_dirs(&self) -> Option<Value> {
|
||||
self.nu_env_dirs()
|
||||
}
|
||||
|
||||
fn reload(&self) {
|
||||
let mut vars = self.vars.lock();
|
||||
|
||||
@ -56,14 +52,6 @@ impl NuConfig {
|
||||
None
|
||||
}
|
||||
|
||||
pub fn nu_env_dirs(&self) -> Option<Value> {
|
||||
let vars = self.vars.lock();
|
||||
if let Some(dirs) = vars.get("nu_env_dirs") {
|
||||
return Some(dirs.clone());
|
||||
}
|
||||
None
|
||||
}
|
||||
|
||||
pub fn path(&self) -> Option<Value> {
|
||||
let vars = self.vars.lock();
|
||||
|
||||
|
@ -16,10 +16,6 @@ impl Conf for FakeConfig {
|
||||
self.config.env()
|
||||
}
|
||||
|
||||
fn nu_env_dirs(&self) -> Option<Value> {
|
||||
None
|
||||
}
|
||||
|
||||
fn path(&self) -> Option<Value> {
|
||||
self.config.path()
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ impl DirectorySpecificEnvironment {
|
||||
}
|
||||
}
|
||||
|
||||
fn toml_if_trusted(&self, mut wdirenv: PathBuf) -> std::io::Result<toml::Value> {
|
||||
fn toml_if_directory_is_trusted(&self, mut wdirenv: PathBuf) -> std::io::Result<toml::Value> {
|
||||
if let Some(trusted) = &self.trusted {
|
||||
wdirenv.push(".nu-env");
|
||||
if wdirenv.exists() {
|
||||
@ -54,8 +54,8 @@ impl DirectorySpecificEnvironment {
|
||||
|
||||
//Start in the current directory, then traverse towards the root with working_dir to see if we are in a subdirectory of a valid directory.
|
||||
while let Some(wdir) = working_dir {
|
||||
if let Ok(toml_doc) = self.toml_if_trusted(wdir.to_path_buf()) {
|
||||
toml_doc
|
||||
if let Ok(toml_doc) = self.toml_if_directory_is_trusted(wdir.to_path_buf()) {
|
||||
toml_doc
|
||||
.get("env")
|
||||
.ok_or_else(|| Error::new(ErrorKind::InvalidData, "env section missing"))?
|
||||
.as_table()
|
||||
|
Loading…
Reference in New Issue
Block a user