From 4ceaf8d00894a7b9fb84581aa5ec05568142c8fb Mon Sep 17 00:00:00 2001 From: Clement Tsang <34804052+ClementTsang@users.noreply.github.com> Date: Fri, 6 May 2022 17:16:57 -0400 Subject: [PATCH] deps: migrate to starship-battery (#724) Migrates the `battery` dependency to the more actively maintained `starship-battery` fork, found at https://github.com/starship/rust-battery. See https://github.com/svartalf/rust-battery/pull/92 for more information. --- Cargo.lock | 49 +++++++++++++-------- Cargo.toml | 3 +- src/app/data_harvester.rs | 2 +- src/app/data_harvester/batteries/battery.rs | 4 +- 4 files changed, 36 insertions(+), 22 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9f99ec6b..1d1693ad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -182,23 +182,6 @@ dependencies = [ "rustc-demangle", ] -[[package]] -name = "battery" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4b624268937c0e0a3edb7c27843f9e547c320d730c610d3b8e6e8e95b2026e4" -dependencies = [ - "cfg-if", - "core-foundation 0.7.0", - "lazycell", - "libc", - "mach", - "nix 0.19.1", - "num-traits", - "uom", - "winapi", -] - [[package]] name = "bitflags" version = "1.3.2" @@ -226,7 +209,6 @@ dependencies = [ "anyhow", "assert_cmd", "backtrace", - "battery", "cargo-husky", "cfg-if", "clap", @@ -252,6 +234,7 @@ dependencies = [ "regex", "serde", "smol", + "starship-battery", "sysinfo", "thiserror", "time", @@ -1040,6 +1023,19 @@ dependencies = [ "libc", ] +[[package]] +name = "nix" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f866317acbd3a240710c63f065ffb1e4fd466259045ccb504130b7f668f35c6" +dependencies = [ + "bitflags", + "cc", + "cfg-if", + "libc", + "memoffset", +] + [[package]] name = "nix" version = "0.24.1" @@ -1451,6 +1447,23 @@ dependencies = [ "winapi", ] +[[package]] +name = "starship-battery" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3336198ad004af4447ae69be4f4e562c26814570f8f0c1e37858405a294e015d" +dependencies = [ + "cfg-if", + "core-foundation 0.7.0", + "lazycell", + "libc", + "mach", + "nix 0.23.1", + "num-traits", + "uom", + "winapi", +] + [[package]] name = "static_assertions" version = "1.1.0" diff --git a/Cargo.toml b/Cargo.toml index e7b8477a..b7b7b5fe 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,6 +32,7 @@ strip = "symbols" [features] default = ["fern", "log", "battery", "gpu"] +battery = ["starship-battery"] deploy = ["battery", "gpu"] gpu = ["nvidia"] nvidia = ["nvml-wrapper"] @@ -64,7 +65,7 @@ unicode-width = "0.1.9" fern = { version = "0.6.1", optional = true } log = { version = "0.4.16", optional = true } -battery = { version = "0.7.8", optional = true } +starship-battery = { version = "0.7.9", optional = true } nvml-wrapper = { version = "0.7.0", optional = true } [target.'cfg(unix)'.dependencies] diff --git a/src/app/data_harvester.rs b/src/app/data_harvester.rs index 86e1a4ca..9dcc377c 100644 --- a/src/app/data_harvester.rs +++ b/src/app/data_harvester.rs @@ -9,7 +9,7 @@ use fxhash::FxHashMap; use sysinfo::{System, SystemExt}; #[cfg(feature = "battery")] -use battery::{Battery, Manager}; +use starship_battery::{Battery, Manager}; use crate::app::layout_manager::UsedWidgets; diff --git a/src/app/data_harvester/batteries/battery.rs b/src/app/data_harvester/batteries/battery.rs index 7e4644e9..85ef3b48 100644 --- a/src/app/data_harvester/batteries/battery.rs +++ b/src/app/data_harvester/batteries/battery.rs @@ -7,9 +7,9 @@ //! - FreeBSD //! - DragonFlyBSD //! -//! For more information, see https://github.com/svartalf/rust-battery +//! For more information, see https://github.com/starship/rust-battery -use battery::{ +use starship_battery::{ units::{power::watt, ratio::percent, time::second}, Battery, Manager, };