mirror of
https://github.com/nushell/nushell.git
synced 2024-11-27 02:44:01 +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 {
|
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()
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
|
|
||||||
|
@ -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()
|
||||||
}
|
}
|
||||||
|
@ -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()
|
||||||
|
Loading…
Reference in New Issue
Block a user