Remove unused code

This commit is contained in:
Sam Hedin 2020-06-22 16:30:43 +02:00
parent a53368ccc8
commit a9469743bc
4 changed files with 3 additions and 24 deletions

View File

@ -4,7 +4,6 @@ use std::fmt::Debug;
pub trait Conf: Debug + Send { pub trait Conf: Debug + Send {
fn env(&self) -> Option<Value>; fn env(&self) -> Option<Value>;
fn path(&self) -> Option<Value>; fn path(&self) -> Option<Value>;
fn nu_env_dirs(&self) -> Option<Value>;
fn reload(&self); fn reload(&self);
} }
@ -13,10 +12,6 @@ impl Conf for Box<dyn Conf> {
(**self).env() (**self).env()
} }
fn nu_env_dirs(&self) -> Option<Value> {
(**self).nu_env_dirs()
}
fn path(&self) -> Option<Value> { fn path(&self) -> Option<Value> {
(**self).path() (**self).path()
} }

View File

@ -20,10 +20,6 @@ impl Conf for NuConfig {
self.path() self.path()
} }
fn nu_env_dirs(&self) -> Option<Value> {
self.nu_env_dirs()
}
fn reload(&self) { fn reload(&self) {
let mut vars = self.vars.lock(); let mut vars = self.vars.lock();
@ -56,14 +52,6 @@ impl NuConfig {
None 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> { pub fn path(&self) -> Option<Value> {
let vars = self.vars.lock(); let vars = self.vars.lock();

View File

@ -16,10 +16,6 @@ impl Conf for FakeConfig {
self.config.env() self.config.env()
} }
fn nu_env_dirs(&self) -> Option<Value> {
None
}
fn path(&self) -> Option<Value> { fn path(&self) -> Option<Value> {
self.config.path() self.config.path()
} }

View File

@ -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 { if let Some(trusted) = &self.trusted {
wdirenv.push(".nu-env"); wdirenv.push(".nu-env");
if wdirenv.exists() { 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. //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 { while let Some(wdir) = working_dir {
if let Ok(toml_doc) = self.toml_if_trusted(wdir.to_path_buf()) { if let Ok(toml_doc) = self.toml_if_directory_is_trusted(wdir.to_path_buf()) {
toml_doc toml_doc
.get("env") .get("env")
.ok_or_else(|| Error::new(ErrorKind::InvalidData, "env section missing"))? .ok_or_else(|| Error::new(ErrorKind::InvalidData, "env section missing"))?
.as_table() .as_table()