diff --git a/Cargo.toml b/Cargo.toml index 81facd3a..aca8088d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -68,7 +68,7 @@ clap = { version = "4.3.2", features = ["derive", "env", "wrap_help"] } console = "0.16" derive_more = { version = "2.0", features = ["as_ref", "debug", "deref", "deref_mut", "display", "error", "from", "from_str", "into"] } either = "1.6" -futures = "0.3.17" +futures = "0.3.32" gherkin = "0.15" globwalk = "0.9" humantime = "2.1" @@ -92,7 +92,7 @@ Inflector = { version = "0.11", default-features = false, optional = true } mime = { version = "0.3.16", optional = true } serde = { version = "1.0.157", features = ["derive"], optional = true } serde_json = { version = "1.0.18", optional = true } -serde_with = { version = "3.0", optional = true } +serde_with = { version = "3.0", features = ["macros"], default-features = false, optional = true } # "output-junit" feature dependencies. junit-report = { version = "0.8", optional = true } diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index 7b6eab3c..eddca44d 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -76,6 +76,7 @@ clippy::needless_collect, clippy::needless_pass_by_ref_mut, clippy::needless_raw_strings, + clippy::needless_type_cast, clippy::non_zero_suggestions, clippy::nonstandard_macro_braces, clippy::option_if_let_else, diff --git a/src/lib.rs b/src/lib.rs index e9e681aa..bc488b39 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -77,6 +77,7 @@ clippy::needless_collect, clippy::needless_pass_by_ref_mut, clippy::needless_raw_strings, + clippy::needless_type_cast, clippy::non_zero_suggestions, clippy::nonstandard_macro_braces, clippy::option_if_let_else, diff --git a/src/runner/basic.rs b/src/runner/basic.rs index 9cadde2b..df81a1c2 100644 --- a/src/runner/basic.rs +++ b/src/runner/basic.rs @@ -1034,8 +1034,8 @@ async fn execute( } } - while let Ok(Some((id, feat, rule, scenario_failed, retried))) = - storage.finished_receiver.try_next() + while let Ok((id, feat, rule, scenario_failed, retried)) = + storage.finished_receiver.try_recv() { if let Some(rule) = rule && let Some(f) = @@ -2305,6 +2305,7 @@ impl Features { /// all retried [`Scenario`]s. /// /// [`Scenario`]: gherkin::Scenario + #[expect(clippy::significant_drop_tightening, reason = "false positive")] async fn get( &self, max_concurrent_scenarios: Option, diff --git a/src/tracing.rs b/src/tracing.rs index 700896be..f46ef565 100644 --- a/src/tracing.rs +++ b/src/tracing.rs @@ -251,7 +251,7 @@ impl Collector { ) -> Option>> { self.notify_about_closing_spans(); - self.logs_receiver.try_next().ok().flatten().map(|(id, msg)| { + self.logs_receiver.try_recv().ok().map(|(id, msg)| { id.and_then(|k| self.scenarios.get(&k)) .map_or_else( || Either::Left(self.scenarios.values()), @@ -274,11 +274,10 @@ impl Collector { /// Notifies all its subscribers about closing [`Span`]s via [`Callback`]s. fn notify_about_closing_spans(&mut self) { - if let Some(id) = self.span_close_receiver.try_next().ok().flatten() { + if let Ok(id) = self.span_close_receiver.try_recv() { self.span_events.entry(id).or_default().1 = true; } - while let Some((id, callback)) = - self.wait_span_event_receiver.try_next().ok().flatten() + while let Ok((id, callback)) = self.wait_span_event_receiver.try_recv() { self.span_events .entry(id) diff --git a/src/writer/summarize.rs b/src/writer/summarize.rs index bbdc7313..44ca3df8 100644 --- a/src/writer/summarize.rs +++ b/src/writer/summarize.rs @@ -320,6 +320,35 @@ impl From for Summarize { } impl Summarize { + /// Wraps the given [`Writer`] into a new [`Summarize`]d one. + #[must_use] + pub fn new(writer: Writer) -> Self { + Self::from(writer) + } + + /// Returns the original [`Writer`], wrapped by this [`Summarize`]d one. + #[must_use] + pub const fn inner_writer(&self) -> &Writer { + &self.writer + } + + /// Returns collected [`Scenario`]s [`Stats`] of this [`Summarize`]d + /// [`Writer`]. + /// + /// [`Scenario`]: gherkin::Scenario + #[must_use] + pub const fn scenarios_stats(&self) -> &Stats { + &self.scenarios + } + + /// Returns collected [`Step`]s [`Stats`] of this [`Summarize`]d [`Writer`]. + /// + /// [`Step`]: gherkin::Step + #[must_use] + pub const fn steps_stats(&self) -> &Stats { + &self.steps + } + /// Keeps track of [`Step`]'s [`Stats`]. /// /// [`Step`]: gherkin::Step @@ -445,37 +474,6 @@ impl Summarize { } } -impl Summarize { - /// Wraps the given [`Writer`] into a new [`Summarize`]d one. - #[must_use] - pub fn new(writer: Writer) -> Self { - Self::from(writer) - } - - /// Returns the original [`Writer`], wrapped by this [`Summarize`]d one. - #[must_use] - pub const fn inner_writer(&self) -> &Writer { - &self.writer - } - - /// Returns collected [`Scenario`]s [`Stats`] of this [`Summarize`]d - /// [`Writer`]. - /// - /// [`Scenario`]: gherkin::Scenario - #[must_use] - pub const fn scenarios_stats(&self) -> &Stats { - &self.scenarios - } - - /// Returns collected [`Step`]s [`Stats`] of this [`Summarize`]d [`Writer`]. - /// - /// [`Step`]: gherkin::Step - #[must_use] - pub const fn steps_stats(&self) -> &Stats { - &self.steps - } -} - /// Marker indicating that a [`Writer`] can be wrapped into a [`Summarize`]. /// /// Not any [`Writer`] can be wrapped into a [`Summarize`], as it may transform