From 0174eeb4cc2e683d9edfa13f0062570dbd625f76 Mon Sep 17 00:00:00 2001 From: emilis Date: Thu, 29 Feb 2024 20:40:21 +0000 Subject: [PATCH] fix warns --- src/config.rs | 19 ------------------- src/hlwm/mod.rs | 30 +++--------------------------- src/hlwm/window.rs | 1 + 3 files changed, 4 insertions(+), 46 deletions(-) diff --git a/src/config.rs b/src/config.rs index e31a690..d593bb2 100644 --- a/src/config.rs +++ b/src/config.rs @@ -82,15 +82,6 @@ pub struct SetAttribute { pub value: Attribute, } -impl SetAttribute { - pub fn new>(path: S, value: Attribute) -> Self { - Self { - path: path.into(), - value, - } - } -} - impl Display for SetAttribute { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!( @@ -963,16 +954,6 @@ pub struct Service { pub arguments: Vec, } -impl Service { - pub fn spawn(&self) -> Result<(), CommandError> { - Client::new().execute(HlwmCommand::Spawn { - executable: self.name.clone(), - args: self.arguments.clone(), - })?; - Ok(()) - } -} - #[cfg(test)] mod test { use pretty_assertions::assert_eq; diff --git a/src/hlwm/mod.rs b/src/hlwm/mod.rs index ff45eea..e55ad19 100644 --- a/src/hlwm/mod.rs +++ b/src/hlwm/mod.rs @@ -3,7 +3,7 @@ use std::{ fmt::Display, num::{ParseFloatError, ParseIntError}, os::unix::process::ExitStatusExt, - process::{self, Child, Stdio}, + process::{self, Stdio}, str::FromStr, }; @@ -58,7 +58,7 @@ impl Client { /// To run the command and return a handle instead of waiting, /// see [Client::spawn] pub fn execute(&self, command: HlwmCommand) -> Result { - let mut args = command.args(); + let args = command.args(); debug!("running command: [{}]", (&args).join(" "),); let output = Self::herbstclient() .args(args) @@ -115,25 +115,6 @@ impl Client { Ok(()) } - pub fn spawn(self, command: HlwmCommand) -> Result { - Ok(Self::herbstclient().args(command.args()).spawn()?) - } - - pub fn set_setting(&self, setting: Setting) -> Result<(), CommandError> { - self.execute(HlwmCommand::Set(setting))?; - Ok(()) - } - - pub fn get_attr_out(&self, attr: String, out: &mut Attribute) -> Result<(), CommandError> { - Ok(*out = Attribute::new( - &out.type_string(), - &self - .query(HlwmCommand::GetAttr(attr))? - .first() - .ok_or(CommandError::Empty)?, - )?) - } - pub fn get_attr(&self, attr: String) -> Result { let attr_type = self .query(HlwmCommand::AttrType(attr.clone()))? @@ -148,11 +129,6 @@ impl Client { Ok(Attribute::new(&attr_type, &attr_val)?) } - pub fn set_attr(&self, path: String, new_value: Attribute) -> Result<(), CommandError> { - self.execute(HlwmCommand::SetAttr { path, new_value })?; - Ok(()) - } - pub fn get_setting(&self, setting: SettingName) -> Result { Ok(Setting::from_str(&String::from_utf8( self.execute(HlwmCommand::Get(setting))?.stdout, @@ -431,7 +407,7 @@ impl FromStr for Align { }; match align { - "bottom" | "vertical" | "horiz" | "v" => Ok(Self::Bottom(fraction)), + "bottom" | "vertical" | "vert" | "v" => Ok(Self::Bottom(fraction)), "left" => Ok(Self::Left(fraction)), "right" | "horizontal" | "horiz" | "h" => Ok(Self::Right(fraction)), "top" => Ok(Self::Top(fraction)), diff --git a/src/hlwm/window.rs b/src/hlwm/window.rs index 0a7f081..d2e7af9 100644 --- a/src/hlwm/window.rs +++ b/src/hlwm/window.rs @@ -65,6 +65,7 @@ pub struct TagStatus { state: TagState, } +#[allow(unused)] impl TagStatus { pub fn name(&self) -> &str { &self.name