summaryrefslogtreecommitdiffstats
path: root/src/modules/battery.rs
diff options
context:
space:
mode:
authorNeil Kistner <neil.kistner@gmail.com>2019-09-09 18:14:38 -0500
committerMatan Kushner <hello@matchai.me>2019-09-09 19:14:38 -0400
commit9f70ffb7a7d2eeef64c360c553e909d38e44adf0 (patch)
tree4dccf8a935e027dcf7bc77781eed1554a645d72a /src/modules/battery.rs
parentdc8409333e194624896c74c5e5cdb4f664f53f9d (diff)
fix: Lazy load git repo and only run module if not disabled (#306)
A couple of optimizations are done in this PR. One, we now will check config ahead of time to see if a module is disabled before running any module code. Also, we won't try to discover a git repository unless the module requests access to it.
Diffstat (limited to 'src/modules/battery.rs')
-rw-r--r--src/modules/battery.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/modules/battery.rs b/src/modules/battery.rs
index 47c9eee73..81edfbf0b 100644
--- a/src/modules/battery.rs
+++ b/src/modules/battery.rs
@@ -29,7 +29,7 @@ pub fn module<'a>(context: &'a Context) -> Option<Module<'a>> {
}
// TODO: Set style based on percentage when threshold is modifiable
- let mut module = context.new_module("battery")?;
+ let mut module = context.new_module("battery");
let module_style = module
.config_value_style("style")
.unwrap_or_else(|| Color::Red.bold());