Environment Default trait

The Environment struct only used the Default trait so it could have the same call for both Environment<UsersCache> and Environment<MockUsers>. There’s no reason to keep it around anymore.
This commit is contained in:
Benjamin Sago 2017-07-05 08:21:24 +01:00
parent 651d23fe8a
commit d27812f819
3 changed files with 3 additions and 5 deletions

View File

@ -140,7 +140,7 @@ impl<'a> Render<'a> {
let mut rows = Vec::new(); let mut rows = Vec::new();
if let Some(columns) = self.opts.columns { if let Some(columns) = self.opts.columns {
let env = Environment::default(); let env = Environment::load_all();
let colz = columns.for_dir(self.dir); let colz = columns.for_dir(self.dir);
let mut table = Table::new(&colz, &self.colours, &env); let mut table = Table::new(&colz, &self.colours, &env);

View File

@ -47,7 +47,7 @@ impl<'a> Render<'a> {
None => Vec::new(), None => Vec::new(),
}; };
let env = Environment::default(); let env = Environment::load_all();
let drender = self.clone().details(); let drender = self.clone().details();

View File

@ -41,10 +41,8 @@ impl Environment {
pub fn lock_users(&self) -> MutexGuard<UsersCache> { pub fn lock_users(&self) -> MutexGuard<UsersCache> {
self.users.lock().unwrap() self.users.lock().unwrap()
} }
}
impl Default for Environment { pub fn load_all() -> Self {
fn default() -> Self {
let tz = match determine_time_zone() { let tz = match determine_time_zone() {
Ok(t) => Some(t), Ok(t) => Some(t),
Err(ref e) => { Err(ref e) => {