diff --git a/comms/core/src/tor/control_client/client.rs b/comms/core/src/tor/control_client/client.rs index 1ab6a0e4a6..cb6fea357a 100644 --- a/comms/core/src/tor/control_client/client.rs +++ b/comms/core/src/tor/control_client/client.rs @@ -111,15 +111,13 @@ impl TorControlPortClient { } /// The GETCONF command. Returns configuration keys matching the `conf_name`. - #[allow(clippy::needless_lifetimes)] - pub async fn get_conf<'a>(&mut self, conf_name: &'a str) -> Result>, TorClientError> { + pub async fn get_conf(&mut self, conf_name: &'static str) -> Result>, TorClientError> { let command = commands::get_conf(conf_name); self.request_response(command).await } /// The GETINFO command. Returns configuration keys matching the `conf_name`. - #[allow(clippy::needless_lifetimes)] - pub async fn get_info<'a>(&mut self, key_name: &'a str) -> Result>, TorClientError> { + pub async fn get_info(&mut self, key_name: &'static str) -> Result>, TorClientError> { let command = commands::get_info(key_name); let response = self.request_response(command).await?; if response.is_empty() { diff --git a/comms/core/src/tor/control_client/commands/key_value.rs b/comms/core/src/tor/control_client/commands/key_value.rs index 2d181f4e2c..f80b1104d3 100644 --- a/comms/core/src/tor/control_client/commands/key_value.rs +++ b/comms/core/src/tor/control_client/commands/key_value.rs @@ -20,50 +20,48 @@ // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE // USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -use std::{borrow::Cow, fmt, marker::PhantomData}; +use std::{borrow::Cow, fmt}; use crate::tor::control_client::{commands::TorCommand, error::TorClientError, parsers, response::ResponseLine}; /// The GETCONF command. /// /// This command is used to query the Tor proxy configuration file. -pub fn get_conf(query: &str) -> KeyValueCommand<'_, '_> { +pub fn get_conf(query: &str) -> KeyValueCommand<'_> { KeyValueCommand::new("GETCONF", &[query]) } /// The GETINFO command. /// /// This command is used to retrieve Tor proxy configuration keys. -pub fn get_info(key_name: &str) -> KeyValueCommand<'_, '_> { +pub fn get_info(key_name: &str) -> KeyValueCommand<'_> { KeyValueCommand::new("GETINFO", &[key_name]) } /// The SETEVENTS command. /// /// This command is used to set the events that tor will emit -pub fn set_events<'b>(event_types: &[&'b str]) -> KeyValueCommand<'static, 'b> { +pub fn set_events<'a>(event_types: &[&'a str]) -> KeyValueCommand<'a> { KeyValueCommand::new("SETEVENTS", event_types) } -pub struct KeyValueCommand<'a, 'b> { - command: &'a str, - args: Vec<&'b str>, - _lifetime: PhantomData<&'b ()>, +pub struct KeyValueCommand<'a> { + command: &'static str, + args: Vec<&'a str>, } -impl<'a, 'b> KeyValueCommand<'a, 'b> { - pub fn new(command: &'a str, args: &[&'b str]) -> Self { +impl<'a> KeyValueCommand<'a> { + pub fn new(command: &'static str, args: &[&'a str]) -> Self { Self { command, args: args.to_vec(), - _lifetime: PhantomData, } } } -impl<'a, 'b> TorCommand for KeyValueCommand<'a, 'b> { +impl<'a> TorCommand for KeyValueCommand<'a> { type Error = TorClientError; - type Output = Vec>; + type Output = Vec>; fn to_command_string(&self) -> Result { Ok(format!("{} {}", self.command, self.args.join(" "))) @@ -99,7 +97,7 @@ impl<'a, 'b> TorCommand for KeyValueCommand<'a, 'b> { } } -impl fmt::Display for KeyValueCommand<'_, '_> { +impl fmt::Display for KeyValueCommand<'_> { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f,