From 0dd402db4a0fbdac178b7b701319e2e520f266b5 Mon Sep 17 00:00:00 2001 From: surajk-m Date: Tue, 29 Oct 2024 13:17:09 +0530 Subject: [PATCH] Use `` generics in `issue_cmd` with `C: Into>` --- src/session.rs | 9 +++++---- tests/local.rs | 15 --------------- 2 files changed, 5 insertions(+), 19 deletions(-) diff --git a/src/session.rs b/src/session.rs index d24d10f..cbb8faa 100644 --- a/src/session.rs +++ b/src/session.rs @@ -336,10 +336,11 @@ impl Client { } /// Issue the specified [`WebDriverCompatibleCommand`] to the WebDriver instance. - pub async fn issue_cmd( - &self, - cmd: impl Into>, - ) -> Result { + pub async fn issue_cmd(&self, cmd: C) -> Result + where + C: Into>, + CC: WebDriverCompatibleCommand + Send + 'static, + { self.issue(Cmd::WebDriver(cmd.into())).await } diff --git a/tests/local.rs b/tests/local.rs index c34a74f..1fe26af 100644 --- a/tests/local.rs +++ b/tests/local.rs @@ -27,21 +27,6 @@ impl WebDriverCompatibleCommand for GetTitle { fn method_and_body(&self, _: &url::Url) -> (http::Method, Option) { (http::Method::GET, None) } - - fn is_new_session(&self) -> bool { - false - } - - fn is_legacy(&self) -> bool { - false - } -} - -// Implement `Into>` for `GetTitle` -impl Into> for GetTitle { - fn into(self) -> Box { - Box::new(self) - } } async fn goto(c: Client, port: u16) -> Result<(), error::CmdError> {