diff --git a/thirtyfour-macros/src/component.rs b/thirtyfour-macros/src/component.rs index 3b15255..d557979 100644 --- a/thirtyfour-macros/src/component.rs +++ b/thirtyfour-macros/src/component.rs @@ -757,6 +757,7 @@ fn is_multi_resolver(path: &syn::Path) -> bool { } /// All args for a single element resolver. +#[allow(clippy::large_enum_variant)] enum SingleResolverOptions { CustomFn(Expr), Opts { @@ -870,6 +871,7 @@ impl ToTokens for SingleResolverArgs { } /// All args for a multi-element resolver. +#[allow(clippy::large_enum_variant)] enum MultiResolverOptions { CustomFn(Expr), Opts { diff --git a/thirtyfour-macros/src/lib.rs b/thirtyfour-macros/src/lib.rs index 68cded3..45d123d 100644 --- a/thirtyfour-macros/src/lib.rs +++ b/thirtyfour-macros/src/lib.rs @@ -53,21 +53,21 @@ pub(crate) use bail; /// /// Optional attributes available within `#[by(..)]` include: /// - `single`: (default, single element only) Return `NoSuchElement` if the number of elements -/// found is != 1. +/// found is != 1. /// - `first`: (single element only) Select the first element that matches the query. -/// By default, a query will return `NoSuchElement` if multiple elements match. -/// This default is designed to catch instances where a query is not specific enough. +/// By default, a query will return `NoSuchElement` if multiple elements match. +/// This default is designed to catch instances where a query is not specific enough. /// - `not_empty`: (default, multi elements only) Return `NoSuchElement` if no elements were found. /// - `allow_empty`: (multi elements only) Return an empty Vec if no elements were found. -/// By default a multi-element query will return `NoSuchElement` if no -/// elements were found. +/// By default a multi-element query will return `NoSuchElement` if no +/// elements were found. /// - `description = "..."`: Set the element description to be displayed in `NoSuchElement` errors. /// - `allow_errors`: Ignore errors such as stale elements while polling. /// - `wait(timeout_ms = 10000, interval_ms=500)`: Override the default polling options. /// - `nowait`: Turn off polling for this element query. /// - `custom = "my_resolve_fn"`: Use the specified function to resolve the element or component. -/// **NOTE**: The `custom` attribute cannot be specified with any other -/// attribute. +/// **NOTE**: The `custom` attribute cannot be specified with any other +/// attribute. /// /// See [`ElementQueryOptions`] for more details on how each option is used. /// diff --git a/thirtyfour/Cargo.toml b/thirtyfour/Cargo.toml index 3fa5e25..c7e7252 100644 --- a/thirtyfour/Cargo.toml +++ b/thirtyfour/Cargo.toml @@ -40,10 +40,11 @@ debug_sync_quit = [] [dependencies] async-trait = "0.1.83" base64 = "0.22" +bytes = "1" futures-util = { version = "0.3.31", default-features = false, features = ["alloc"] } http = "1" indexmap = "2" -paste = "1" +pastey = "0.1" serde = { version = "1.0.210", features = ["derive", "rc"] } serde_json = { version = "1.0.132", features = ["preserve_order"] } serde_repr = "0.1.19" @@ -51,7 +52,7 @@ stringmatch = "0.4" thirtyfour-macros = { path = "../thirtyfour-macros", version = "0.2.0", optional = true } thiserror = "2.0.12" arc-swap = "1" -tokio = { version = "1", features = [ +tokio = { version = "1.30", features = [ "rt", "macros", "time", @@ -70,9 +71,9 @@ reqwest = { version = "0.12.8", default-features = false, features = [ [dev-dependencies] assert_matches = "1.5" -axum = "0.7" +axum = "0.8" color-eyre = "0.6" -rstest = { version = "0.25.0", default-features = false } +rstest = { version = "0.26", default-features = false } tower-http = { version = "0.6", features = ["fs"] } tracing-subscriber = { version = "0.3", features = ["env-filter"] } tokio = { version = "1", features = ["rt-multi-thread"] } diff --git a/thirtyfour/src/common/capabilities/chromium.rs b/thirtyfour/src/common/capabilities/chromium.rs index 85b3da2..e7d2b8a 100644 --- a/thirtyfour/src/common/capabilities/chromium.rs +++ b/thirtyfour/src/common/capabilities/chromium.rs @@ -1,7 +1,7 @@ use std::path::Path; use base64::{prelude::BASE64_STANDARD, Engine}; -use paste::paste; +use pastey::paste; use serde::Serialize; use serde_json::{json, to_value, Value}; diff --git a/thirtyfour/src/common/capabilities/firefox.rs b/thirtyfour/src/common/capabilities/firefox.rs index 7aa7c51..9b8d416 100644 --- a/thirtyfour/src/common/capabilities/firefox.rs +++ b/thirtyfour/src/common/capabilities/firefox.rs @@ -1,4 +1,4 @@ -use paste::paste; +use pastey::paste; use serde::{Deserialize, Serialize}; use serde_json::{from_value, json, to_value, Value}; diff --git a/thirtyfour/src/extensions/query/conditions.rs b/thirtyfour/src/extensions/query/conditions.rs index 5ca48ae..b7b6995 100644 --- a/thirtyfour/src/extensions/query/conditions.rs +++ b/thirtyfour/src/extensions/query/conditions.rs @@ -212,7 +212,7 @@ macro_rules! elem_matches { } }; (many [$name: ident] $field: ident => $plural: ident) => { - paste::paste! { + pastey::paste! { #[doc = concat!("Predicate that returns true for elements that have all the ",stringify!($plural)," specified with the")] ///specified values. See the `Needle` documentation for more details on text matching rules. pub fn []( @@ -245,7 +245,7 @@ macro_rules! elem_matches { } }; (single [$name: ident] $field: ident => $single: ident) => { - paste::paste! { + pastey::paste! { #[doc = concat!("Predicate that returns true for elements that have the specified ",stringify!($plural)," with the specified")] ///value. See the `Needle` documentation for more details on text matching rules. pub fn []( diff --git a/thirtyfour/src/extensions/query/element_query.rs b/thirtyfour/src/extensions/query/element_query.rs index 18e7d7e..c47bd39 100644 --- a/thirtyfour/src/extensions/query/element_query.rs +++ b/thirtyfour/src/extensions/query/element_query.rs @@ -31,7 +31,7 @@ fn get_selector_summary(selectors: &[ElementSelector]) -> String { format!("[{}]", Criteria(selectors)) } -fn get_elements_description(len: Option, description: &str) -> Cow { +fn get_elements_description(len: Option, description: &str) -> Cow<'_, str> { let suffix = match len { Some(1) => "element", Some(_) => "elements", @@ -55,7 +55,7 @@ fn no_such_element(selectors: &[ElementSelector], description: &str) -> WebDrive } /// Filter the specified elements using the specified filters. -pub async fn filter_elements<'a, I, P, Ref>( +pub async fn filter_elements( mut elements: Vec, filters: I, ) -> WebDriverResult> @@ -364,8 +364,7 @@ impl ElementQuery { pub async fn first(&self) -> WebDriverResult { self.first_opt().await?.ok_or_else(|| { let desc: &str = self.options.description.as_deref().unwrap_or(""); - let err = no_such_element(&self.selectors, desc); - err + no_such_element(&self.selectors, desc) }) } diff --git a/thirtyfour/src/session/http.rs b/thirtyfour/src/session/http.rs index 4b60344..7512ab0 100644 --- a/thirtyfour/src/session/http.rs +++ b/thirtyfour/src/session/http.rs @@ -46,7 +46,7 @@ pub trait HttpClient: Send + Sync + 'static { /// or couldn't prove its availability /// this isn't a simple clone, /// this new client needs to be able to run in a new runtime even if the old runtime has been destroyed - + // // needed for object safety #[allow(clippy::new_ret_no_self)] #[allow(clippy::wrong_self_convention)] diff --git a/thirtyfour/tests/common.rs b/thirtyfour/tests/common.rs index a25e72c..2324c88 100644 --- a/thirtyfour/tests/common.rs +++ b/thirtyfour/tests/common.rs @@ -58,7 +58,7 @@ pub fn start_server() -> Arc> { let addr = SocketAddr::from(([127, 0, 0, 1], PORT)); let listener = tokio::net::TcpListener::bind(addr).await.unwrap(); let app = axum::Router::new() - .nest_service("/", tower_http::services::ServeDir::new(ASSETS_DIR)); + .fallback_service(tower_http::services::ServeDir::new(ASSETS_DIR)); axum::serve(listener, app).await.unwrap(); }); }); @@ -87,7 +87,7 @@ pub fn get_limiter() -> &'static Semaphore { /// Locks the Firefox browser for exclusive use. /// /// This ensures there is only ever one Firefox browser running at a time. -pub async fn lock_firefox<'a>(browser: &str) -> Option> { +pub async fn lock_firefox(browser: &str) -> Option> { if browser == "firefox" { Some(get_limiter().acquire().await.unwrap()) } else {