From ef96646f1c6ed999d45bdf6c82da4288f61cb023 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Wed, 4 May 2022 20:11:48 -0700 Subject: [PATCH] deps: migrate battery to starship-battery The former is unmaintained and is flagging in cargo audit for its indirect deps. The starship folks have forked it; let's use that. refs: https://github.com/svartalf/rust-battery/pull/92 refs: https://github.com/wez/wezterm/issues/1952 --- Cargo.lock | 48 ++++++++++++++++++----------------------------- config/Cargo.toml | 2 +- config/src/lua.rs | 2 +- 3 files changed, 20 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c65f7f5909e..36ea2ad8b05 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -332,23 +332,6 @@ checksum = "904dfeac50f3cdaba28fc6f57fdcddb75f49ed61346676a78c4ffe55877802fd" name = "base91" version = "0.1.0" -[[package]] -name = "battery" -version = "0.7.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4b624268937c0e0a3edb7c27843f9e547c320d730c610d3b8e6e8e95b2026e4" -dependencies = [ - "cfg-if 1.0.0", - "core-foundation 0.7.0", - "lazycell", - "libc", - "mach", - "nix 0.19.1", - "num-traits", - "uom", - "winapi 0.3.9", -] - [[package]] name = "benchmarking" version = "0.4.11" @@ -659,7 +642,6 @@ name = "config" version = "0.1.0" dependencies = [ "anyhow", - "battery", "bitflags", "bstr 0.2.17", "chrono", @@ -683,6 +665,7 @@ dependencies = [ "serde_json", "shlex", "smol", + "starship-battery", "terminfo", "termwiz", "toml", @@ -2348,18 +2331,6 @@ dependencies = [ "winapi 0.3.9", ] -[[package]] -name = "nix" -version = "0.19.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2ccba0cfe4fdf15982d1674c69b1fd80bad427d293849982668dfe454bd61f2" -dependencies = [ - "bitflags", - "cc", - "cfg-if 1.0.0", - "libc", -] - [[package]] name = "nix" version = "0.22.3" @@ -3868,6 +3839,23 @@ dependencies = [ "parking_lot 0.11.2", ] +[[package]] +name = "starship-battery" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3336198ad004af4447ae69be4f4e562c26814570f8f0c1e37858405a294e015d" +dependencies = [ + "cfg-if 1.0.0", + "core-foundation 0.7.0", + "lazycell", + "libc", + "mach", + "nix 0.23.1", + "num-traits", + "uom", + "winapi 0.3.9", +] + [[package]] name = "static_assertions" version = "1.1.0" diff --git a/config/Cargo.toml b/config/Cargo.toml index 180e216b8f4..2ac34c73e45 100644 --- a/config/Cargo.toml +++ b/config/Cargo.toml @@ -12,7 +12,7 @@ env_logger = "0.9" [dependencies] anyhow = "1.0" -battery = "0.7" +starship-battery = "0.7" bitflags = "1.3" bstr = "0.2" chrono = {version="0.4", features=["unstable-locales"]} diff --git a/config/src/lua.rs b/config/src/lua.rs index a996d4e76ea..17a0f972c7c 100644 --- a/config/src/lua.rs +++ b/config/src/lua.rs @@ -391,7 +391,7 @@ fn opt_string(s: Option<&str>) -> String { } fn battery_info<'lua>(_: &'lua Lua, _: ()) -> mlua::Result> { - use battery::{Manager, State}; + use starship_battery::{Manager, State}; let manager = Manager::new().map_err(|e| mlua::Error::external(e))?; let mut result = vec![]; for b in manager.batteries().map_err(|e| mlua::Error::external(e))? {