From b46930c32ef5ae490df8063905144a45de27eda1 Mon Sep 17 00:00:00 2001 From: tyranron Date: Fri, 29 Nov 2024 12:23:35 +0100 Subject: [PATCH] Tune lints for 1.83 Rust - bump up MSRV to 1.83 --- .github/workflows/ci.yml | 2 +- CHANGELOG.md | 3 ++- Cargo.toml | 4 ++-- README.md | 2 +- codegen/CHANGELOG.md | 3 ++- codegen/Cargo.toml | 2 +- codegen/README.md | 2 +- codegen/src/lib.rs | 7 ++----- src/lib.rs | 7 ++----- src/runner/basic.rs | 14 +++----------- src/writer/out.rs | 2 +- 11 files changed, 18 insertions(+), 30 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e0972fdc..9509f085 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -106,7 +106,7 @@ jobs: strategy: fail-fast: false matrix: - msrv: ["1.81.0"] + msrv: ["1.83.0"] crate: - cucumber-codegen - cucumber diff --git a/CHANGELOG.md b/CHANGELOG.md index f9e52dad..89cb7bb8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,10 +13,11 @@ All user visible changes to `cucumber` crate will be documented in this file. Th ### BC Breaks -- Bumped up [MSRV] to 1.81 to get rid of `once_cell` crate and for `#[expect]` attribute usage. ([4010c1ad], [f1307038]) +- Bumped up [MSRV] to 1.83 to get rid of `once_cell` crate and for `#[expect]` attribute usage. ([4010c1ad], [f1307038], [todo]) [4010c1ad]: /../../commit/4010c1ad6a53d6b7f0b28cefea73c8c13e880e9f [f1307038]: /../../commit/f1307038cb6b1e38c1cc259a0e09fb583033d0cf +[todo]: /../../commit/todo diff --git a/Cargo.toml b/Cargo.toml index abdead1e..24116bb1 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ name = "cucumber" version = "0.21.1" edition = "2021" -rust-version = "1.81" +rust-version = "1.83" description = """\ Cucumber testing framework for Rust, with async support. \ Fully native, no external test runners or dependencies.\ @@ -89,7 +89,7 @@ inventory = { version = "0.3", optional = true } base64 = { version = "0.22", optional = true } Inflector = { version = "0.11", default-features = false, optional = true } mime = { version = "0.3.16", optional = true } -serde = { version = "1.0.103", features = ["derive"], optional = true } +serde = { version = "1.0.157", features = ["derive"], optional = true } serde_json = { version = "1.0.18", optional = true } # "output-junit" feature dependencies. diff --git a/README.md b/README.md index f9b67da2..0b0973bb 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Cucumber testing framework for Rust =================================== [![crates.io](https://img.shields.io/crates/v/cucumber.svg?maxAge=2592000 "crates.io")](https://crates.io/crates/cucumber) -[![Rust 1.81+](https://img.shields.io/badge/rustc-1.81+-lightgray.svg "Rust 1.81+")](https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html) +[![Rust 1.83+](https://img.shields.io/badge/rustc-1.83+-lightgray.svg "Rust 1.83+")](https://blog.rust-lang.org/2024/11/28/Rust-1.83.0.html) [![Unsafe Forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg "Unsafe forbidden")](https://github.com/rust-secure-code/safety-dance) [![CI](https://github.com/cucumber-rs/cucumber/workflows/CI/badge.svg?branch=main "CI")](https://github.com/cucumber-rs/cucumber/actions?query=workflow%3ACI+branch%3Amain) [![Rust docs](https://docs.rs/cucumber/badge.svg "Rust docs")](https://docs.rs/cucumber) diff --git a/codegen/CHANGELOG.md b/codegen/CHANGELOG.md index 741ed862..448d2e47 100644 --- a/codegen/CHANGELOG.md +++ b/codegen/CHANGELOG.md @@ -13,10 +13,11 @@ All user visible changes to `cucumber-codegen` crate will be documented in this ### BC Breaks -- Bumped up [MSRV] to 1.81 to get rid of `once_cell` crate and for `#[expect]` attribute usage. ([4010c1ad], [f1307038]) +- Bumped up [MSRV] to 1.83 to get rid of `once_cell` crate and for `#[expect]` attribute usage. ([4010c1ad], [f1307038], [todo]) [4010c1ad]: /../../commit/4010c1ad6a53d6b7f0b28cefea73c8c13e880e9f [f1307038]: /../../commit/f1307038cb6b1e38c1cc259a0e09fb583033d0cf +[todo]: /../../commit/todo diff --git a/codegen/Cargo.toml b/codegen/Cargo.toml index 3b22a511..00122302 100644 --- a/codegen/Cargo.toml +++ b/codegen/Cargo.toml @@ -2,7 +2,7 @@ name = "cucumber-codegen" version = "0.21.1" # should be the same as main crate version edition = "2021" -rust-version = "1.81" +rust-version = "1.83" description = "Code generation for `cucumber` crate." license = "MIT OR Apache-2.0" authors = [ diff --git a/codegen/README.md b/codegen/README.md index c7510a7d..7f6751c7 100644 --- a/codegen/README.md +++ b/codegen/README.md @@ -2,7 +2,7 @@ ======================== [![crates.io](https://img.shields.io/crates/v/cucumber-codegen.svg?maxAge=2592000 "crates.io")](https://crates.io/crates/cucumber-codegen) -[![Rust 1.81+](https://img.shields.io/badge/rustc-1.81+-lightgray.svg "Rust 1.81+")](https://blog.rust-lang.org/2024/09/05/Rust-1.81.0.html) +[![Rust 1.83+](https://img.shields.io/badge/rustc-1.83+-lightgray.svg "Rust 1.83+")](https://blog.rust-lang.org/2024/11/28/Rust-1.83.0.html) [![Unsafe Forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg "Unsafe forbidden")](https://github.com/rust-secure-code/safety-dance) [![CI](https://github.com/cucumber-rs/cucumber/workflows/CI/badge.svg?branch=main "CI")](https://github.com/cucumber-rs/cucumber/actions?query=workflow%3ACI+branch%3Amain) [![Rust docs](https://docs.rs/cucumber-codegen/badge.svg "Rust docs")](https://docs.rs/cucumber-codegen) diff --git a/codegen/src/lib.rs b/codegen/src/lib.rs index 101b9842..d12630ed 100644 --- a/codegen/src/lib.rs +++ b/codegen/src/lib.rs @@ -42,7 +42,6 @@ clippy::derive_partial_eq_without_eq, clippy::else_if_without_else, clippy::empty_drop, - clippy::empty_line_after_outer_attr, clippy::empty_structs_with_brackets, clippy::equatable_if_let, clippy::empty_enum_variants_with_brackets, @@ -51,13 +50,11 @@ clippy::fallible_impl_from, clippy::filetype_is_file, clippy::float_cmp_const, - clippy::fn_to_numeric_cast, clippy::fn_to_numeric_cast_any, clippy::format_push_string, clippy::get_unwrap, clippy::if_then_some_else_none, clippy::imprecise_flops, - clippy::index_refutable_slice, clippy::infinite_loop, clippy::iter_on_empty_collections, clippy::iter_on_single_items, @@ -67,7 +64,6 @@ clippy::large_stack_frames, clippy::let_underscore_untyped, clippy::lossy_float_literal, - clippy::manual_c_str_literals, clippy::map_err_ignore, clippy::mem_forget, clippy::missing_assert_message, @@ -81,6 +77,7 @@ clippy::needless_collect, clippy::needless_pass_by_ref_mut, clippy::needless_raw_strings, + clippy::non_zero_suggestions, clippy::nonstandard_macro_braces, clippy::option_if_let_else, clippy::or_fun_call, @@ -91,7 +88,6 @@ clippy::print_stderr, clippy::print_stdout, clippy::pub_without_shorthand, - clippy::ref_as_ptr, clippy::rc_buffer, clippy::rc_mutex, clippy::read_zero_byte_vec, @@ -132,6 +128,7 @@ clippy::unneeded_field_pattern, clippy::unused_peekable, clippy::unused_result_ok, + clippy::unused_trait_names, clippy::unwrap_in_result, clippy::unwrap_used, clippy::use_debug, diff --git a/src/lib.rs b/src/lib.rs index 5dcf0e24..2c1ac072 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -43,7 +43,6 @@ clippy::derive_partial_eq_without_eq, clippy::else_if_without_else, clippy::empty_drop, - clippy::empty_line_after_outer_attr, clippy::empty_structs_with_brackets, clippy::equatable_if_let, clippy::empty_enum_variants_with_brackets, @@ -52,13 +51,11 @@ clippy::fallible_impl_from, clippy::filetype_is_file, clippy::float_cmp_const, - clippy::fn_to_numeric_cast, clippy::fn_to_numeric_cast_any, clippy::format_push_string, clippy::get_unwrap, clippy::if_then_some_else_none, clippy::imprecise_flops, - clippy::index_refutable_slice, clippy::infinite_loop, clippy::iter_on_empty_collections, clippy::iter_on_single_items, @@ -68,7 +65,6 @@ clippy::large_stack_frames, clippy::let_underscore_untyped, clippy::lossy_float_literal, - clippy::manual_c_str_literals, clippy::map_err_ignore, clippy::mem_forget, clippy::missing_assert_message, @@ -82,6 +78,7 @@ clippy::needless_collect, clippy::needless_pass_by_ref_mut, clippy::needless_raw_strings, + clippy::non_zero_suggestions, clippy::nonstandard_macro_braces, clippy::option_if_let_else, clippy::or_fun_call, @@ -92,7 +89,6 @@ clippy::print_stderr, clippy::print_stdout, clippy::pub_without_shorthand, - clippy::ref_as_ptr, clippy::rc_buffer, clippy::rc_mutex, clippy::read_zero_byte_vec, @@ -133,6 +129,7 @@ clippy::unneeded_field_pattern, clippy::unused_peekable, clippy::unused_result_ok, + clippy::unused_trait_names, clippy::unwrap_in_result, clippy::unwrap_used, clippy::use_debug, diff --git a/src/runner/basic.rs b/src/runner/basic.rs index 5ebb120e..1fae30ac 100644 --- a/src/runner/basic.rs +++ b/src/runner/basic.rs @@ -898,8 +898,6 @@ async fn insert_features( #[expect(clippy::too_many_lines, reason = "needs refactoring")] #[cfg_attr( feature = "tracing", - // TODO: Try remove on next Rust version update. - expect(clippy::duplicated_attributes, reason = "false positive"), expect(clippy::too_many_arguments, reason = "needs refactoring") )] async fn execute( @@ -955,13 +953,6 @@ async fn execute( executor.send_event(event::Cucumber::Started); - // TODO: Replace with `ControlFlow::map_break()` once stabilized: - // https://github.com/rust-lang/rust/issues/75744 - let map_break = |cf| match cf { - ControlFlow::Continue(cont) => cont, - ControlFlow::Break(()) => Some(0), - }; - #[cfg(feature = "tracing")] let waiter = logs_collector .as_ref() @@ -970,8 +961,9 @@ async fn execute( let mut started_scenarios = ControlFlow::Continue(max_concurrent_scenarios); let mut run_scenarios = stream::FuturesUnordered::new(); loop { - let (runnable, sleep) = - features.get(map_break(started_scenarios)).await; + let (runnable, sleep) = features + .get(started_scenarios.continue_value().unwrap_or(Some(0))) + .await; if run_scenarios.is_empty() && runnable.is_empty() { if features.is_finished(started_scenarios.is_break()).await { break; diff --git a/src/writer/out.rs b/src/writer/out.rs index bdde6075..d07ec9e2 100644 --- a/src/writer/out.rs +++ b/src/writer/out.rs @@ -12,7 +12,7 @@ use std::{ borrow::Cow, - io::{self, IsTerminal}, + io::{self, IsTerminal as _}, mem, str, };