Ver Fonte

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.
Benjamin Sago há 8 anos atrás
pai
commit
d27812f819
3 ficheiros alterados com 3 adições e 5 exclusões
  1. 1 1
      src/output/details.rs
  2. 1 1
      src/output/grid_details.rs
  3. 1 3
      src/output/table.rs

+ 1 - 1
src/output/details.rs

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

+ 1 - 1
src/output/grid_details.rs

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

+ 1 - 3
src/output/table.rs

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