Fix warnings in battery

This commit is contained in:
Alexander Bantyev 2020-09-16 22:02:56 +03:00
parent 56cd8f7741
commit 625e2355b9
Signed by: balsoft
GPG Key ID: E081FF12ADCB4AD5

View File

@ -8,11 +8,9 @@ use std::io;
use std::thread; use std::thread;
use std::time::Duration; use std::time::Duration;
use osd::notify::{OSD, OSDContents, OSDProgressText, Urgency}; use osd::notify::{OSD, Urgency};
use osd::config::Config; use osd::config::Config;
use battery::units::Time;
#[derive(Debug)] #[derive(Debug)]
enum Threshold { enum Threshold {
Percentage(i32), Percentage(i32),
@ -42,8 +40,8 @@ fn parse_threshold(thresh: String) -> Option<Threshold> {
fn main() -> battery::Result<()> { fn main() -> battery::Result<()> {
let mut config = Config::new("battery"); let mut config = Config::new("battery");
let mut low_threshold_str = config.get_default("threshold", "low", String::from("30m")); let low_threshold_str = config.get_default("threshold", "low", String::from("30m"));
let mut critical_threshold_str = config.get_default("threshold", "critical", String::from("10m")); let critical_threshold_str = config.get_default("threshold", "critical", String::from("10m"));
let low_threshold = parse_threshold(low_threshold_str).expect("Low threshold is incorrect: must be either a percentage or minutes"); let low_threshold = parse_threshold(low_threshold_str).expect("Low threshold is incorrect: must be either a percentage or minutes");
let critical_threshold = parse_threshold(critical_threshold_str).expect("Critical threshold is incorrect: must be either a percentage or minutes"); let critical_threshold = parse_threshold(critical_threshold_str).expect("Critical threshold is incorrect: must be either a percentage or minutes");