Skip to content

Commit

Permalink
Tune lints for 1.81 Rust
Browse files Browse the repository at this point in the history
- bump up MSRV to 1.81
  • Loading branch information
tyranron committed Sep 6, 2024
1 parent 5f0f8ad commit 88d7c71
Show file tree
Hide file tree
Showing 18 changed files with 41 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
strategy:
fail-fast: false
matrix:
msrv: ["1.75.0"]
msrv: ["1.81.0"]
os: ["ubuntu", "macOS", "windows"]
runs-on: ${{ matrix.os }}-latest
steps:
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "arcane"
version = "0.1.0-dev"
edition = "2021"
rust-version = "1.75"
rust-version = "1.81"
description = "Opionated CQRS/ES framework with type magic."
authors = [
"Ilya Solovyiov <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ arcane
======

[![crates.io](https://img.shields.io/crates/v/arcane.svg "crates.io")](https://crates.io/crates/arcane)
[![Rust 1.75+](https://img.shields.io/badge/rustc-1.75+-lightgray.svg "Rust 1.75+")](https://blog.rust-lang.org/2023/12/28/Rust-1.75.0.html)
[![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)
[![CI](https://github.com/arcane-rs/arcane/workflows/CI/badge.svg?branch=main "CI")](https://github.com/arcane-rs/arcane/actions?query=workflow%3ACI+branch%3Amain)
[![Rust docs](https://docs.rs/arcane/badge.svg "Rust docs")](https://docs.rs/arcane)
2 changes: 1 addition & 1 deletion codegen/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "arcane-codegen"
version = "0.1.0-dev"
edition = "2021"
rust-version = "1.75"
rust-version = "1.81"
description = "Code generation for `arcane` crate."
authors = [
"Ilya Solovyiov <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion codegen/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ arcane-codegen
==============

[![crates.io](https://img.shields.io/crates/v/arcane-codegen.svg "crates.io")](https://crates.io/crates/arcane-codegen)
[![Rust 1.75+](https://img.shields.io/badge/rustc-1.75+-lightgray.svg "Rust 1.75+")](https://blog.rust-lang.org/2023/12/28/Rust-1.75.0.html)
[![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)
[![Unsafe Forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg "Unsafe forbidden")](https://github.com/rust-secure-code/safety-dance)
[![Rust docs](https://docs.rs/arcane-codegen/badge.svg "Rust docs")](https://docs.rs/arcane-codegen)

Expand Down
2 changes: 1 addition & 1 deletion codegen/impl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "arcane-codegen-impl"
version = "0.1.0-dev"
edition = "2021"
rust-version = "1.75"
rust-version = "1.81"
description = "Code generation implementation of `arcane-codegen` crate."
authors = [
"Ilya Solovyiov <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion codegen/impl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ arcane-codegen-impl
===================

[![crates.io](https://img.shields.io/crates/v/arcane-codegen-impl.svg "crates.io")](https://crates.io/crates/arcane-codegen-impl)
[![Rust 1.75+](https://img.shields.io/badge/rustc-1.75+-lightgray.svg "Rust 1.75+")](https://blog.rust-lang.org/2023/12/28/Rust-1.75.0.html)
[![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)
[![Unsafe Forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg "Unsafe forbidden")](https://github.com/rust-secure-code/safety-dance)
[![Rust docs](https://docs.rs/arcane-codegen-impl/badge.svg "Rust docs")](https://docs.rs/arcane-codegen-impl)

Expand Down
8 changes: 4 additions & 4 deletions codegen/impl/src/es/event/impl_enum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ mod spec {
Ok(Definition::try_from(input)?.into_token_stream())
}

#[allow(clippy::too_many_lines)] // OK for macro expansion test
#[expect(clippy::too_many_lines, reason = "OK for macro expansion test")]
#[test]
fn derives_enum_impl() {
let input = parse_quote! {
Expand Down Expand Up @@ -582,7 +582,7 @@ mod spec {
assert_eq!(derive(input).unwrap().to_string(), output.to_string());
}

#[allow(clippy::too_many_lines)] // OK for macro expansion test
#[expect(clippy::too_many_lines, reason = "OK for macro expansion test")]
#[test]
fn derives_enum_impl_with_revision() {
let input = parse_quote! {
Expand Down Expand Up @@ -712,7 +712,7 @@ mod spec {
assert_eq!(derive(input).unwrap().to_string(), output.to_string());
}

#[allow(clippy::too_many_lines)] // OK for macro expansion test
#[expect(clippy::too_many_lines, reason = "OK for macro expansion test")]
#[test]
fn derives_enum_with_generics_impl() {
let input = parse_quote! {
Expand Down Expand Up @@ -860,7 +860,7 @@ mod spec {
assert_eq!(derive(input).unwrap().to_string(), output.to_string());
}

#[allow(clippy::too_many_lines)] // OK for macro expansion test
#[expect(clippy::too_many_lines, reason = "OK for macro expansion test")]
#[test]
fn ignores_ignored_variant() {
let input_ignore = parse_quote! {
Expand Down
4 changes: 4 additions & 0 deletions codegen/impl/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
#![forbid(non_ascii_idents, unsafe_code)]
#![warn(
clippy::absolute_paths,
clippy::allow_attributes,
clippy::allow_attributes_without_reason,
clippy::as_conversions,
clippy::as_ptr_cast_mut,
clippy::assertions_on_result_states,
clippy::branches_sharing_code,
clippy::cfg_not_test,
clippy::clear_with_drain,
clippy::clone_on_ref_ptr,
clippy::collection_is_never_read,
Expand Down Expand Up @@ -85,6 +88,7 @@
clippy::rest_pat_in_fully_bound_structs,
clippy::same_name_method,
clippy::semicolon_inside_block,
clippy::set_contains_or_insert,
clippy::shadow_unrelated,
clippy::significant_drop_in_scrutinee,
clippy::significant_drop_tightening,
Expand Down
2 changes: 1 addition & 1 deletion codegen/shim/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "arcane-codegen-shim"
version = "0.1.0-dev"
edition = "2021"
rust-version = "1.75"
rust-version = "1.81"
description = "Internal proc macro shim of `arcane-codegen` crate."
authors = [
"Ilya Solovyiov <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion codegen/shim/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ arcane-codegen-shim
===================

[![crates.io](https://img.shields.io/crates/v/arcane-codegen-shim.svg "crates.io")](https://crates.io/crates/arcane-codegen-shim)
[![Rust 1.75+](https://img.shields.io/badge/rustc-1.75+-lightgray.svg "Rust 1.75+")](https://blog.rust-lang.org/2023/12/28/Rust-1.75.0.html)
[![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)
[![Unsafe Forbidden](https://img.shields.io/badge/unsafe-forbidden-success.svg "Unsafe forbidden")](https://github.com/rust-secure-code/safety-dance)
[![Rust docs](https://docs.rs/arcane-codegen-shim/badge.svg "Rust docs")](https://docs.rs/arcane-codegen-shim)

Expand Down
4 changes: 4 additions & 0 deletions codegen/shim/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
#![forbid(non_ascii_idents, unsafe_code)]
#![warn(
clippy::absolute_paths,
clippy::allow_attributes,
clippy::allow_attributes_without_reason,
clippy::as_conversions,
clippy::as_ptr_cast_mut,
clippy::assertions_on_result_states,
clippy::branches_sharing_code,
clippy::cfg_not_test,
clippy::clear_with_drain,
clippy::clone_on_ref_ptr,
clippy::collection_is_never_read,
Expand Down Expand Up @@ -85,6 +88,7 @@
clippy::rest_pat_in_fully_bound_structs,
clippy::same_name_method,
clippy::semicolon_inside_block,
clippy::set_contains_or_insert,
clippy::shadow_unrelated,
clippy::significant_drop_in_scrutinee,
clippy::significant_drop_tightening,
Expand Down
10 changes: 6 additions & 4 deletions codegen/src/es/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,18 @@ pub const fn concat_slices<T: Copy, const LEN: usize>(
let mut first_elem = None;
while i < input.len() {
total_len += input[i].len();
// error: cannot borrow here, since the borrowed element may contain
// interior mutability
#[allow(clippy::redundant_pattern_matching)] // false positive
#[expect( // false positive
clippy::redundant_pattern_matching,
reason = "error: cannot borrow here, since the borrowed \
element may contain interior mutability",
)]
if matches!(first_elem, None) && total_len > 0 {
first_elem = Some(input[i][0]);
}
i += 1;
}
// TODO: Use `assert_ne!()` here, once it's allowed in `const` context.
#[allow(clippy::manual_assert)] // const context
#[expect(clippy::manual_assert, reason = "const context")]
if total_len != LEN {
panic!("actual slices lengths mismatches the specified `LEN` const")
}
Expand Down
4 changes: 4 additions & 0 deletions codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
#![forbid(non_ascii_idents, unsafe_code)]
#![warn(
clippy::absolute_paths,
clippy::allow_attributes,
clippy::allow_attributes_without_reason,
clippy::as_conversions,
clippy::as_ptr_cast_mut,
clippy::assertions_on_result_states,
clippy::branches_sharing_code,
clippy::cfg_not_test,
clippy::clear_with_drain,
clippy::clone_on_ref_ptr,
clippy::collection_is_never_read,
Expand Down Expand Up @@ -85,6 +88,7 @@
clippy::rest_pat_in_fully_bound_structs,
clippy::same_name_method,
clippy::semicolon_inside_block,
clippy::set_contains_or_insert,
clippy::shadow_unrelated,
clippy::significant_drop_in_scrutinee,
clippy::significant_drop_tightening,
Expand Down
2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "arcane-core"
version = "0.1.0-dev"
edition = "2021"
rust-version = "1.75"
rust-version = "1.81"
description = "Core abstractions and implementations of `arcane` crate."
authors = [
"Ilya Solovyiov <[email protected]>",
Expand Down
2 changes: 1 addition & 1 deletion core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ arcane-core
===========

[![crates.io](https://img.shields.io/crates/v/arcane-core.svg "crates.io")](https://crates.io/crates/arcane-core)
[![Rust 1.75+](https://img.shields.io/badge/rustc-1.75+-lightgray.svg "Rust 1.75+")](https://blog.rust-lang.org/2023/12/28/Rust-1.75.0.html)
[![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 docs](https://docs.rs/arcane-core/badge.svg "Rust docs")](https://docs.rs/arcane-core)

Core abstractions and implementations of [`arcane`] crate.
Expand Down
4 changes: 4 additions & 0 deletions core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
#![forbid(non_ascii_idents)]
#![warn(
clippy::absolute_paths,
clippy::allow_attributes,
clippy::allow_attributes_without_reason,
clippy::as_conversions,
clippy::as_ptr_cast_mut,
clippy::assertions_on_result_states,
clippy::branches_sharing_code,
clippy::cfg_not_test,
clippy::clear_with_drain,
clippy::clone_on_ref_ptr,
clippy::collection_is_never_read,
Expand Down Expand Up @@ -85,6 +88,7 @@
clippy::rest_pat_in_fully_bound_structs,
clippy::same_name_method,
clippy::semicolon_inside_block,
clippy::set_contains_or_insert,
clippy::shadow_unrelated,
clippy::significant_drop_in_scrutinee,
clippy::significant_drop_tightening,
Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,13 @@
#![forbid(non_ascii_idents, unsafe_code)]
#![warn(
clippy::absolute_paths,
clippy::allow_attributes,
clippy::allow_attributes_without_reason,
clippy::as_conversions,
clippy::as_ptr_cast_mut,
clippy::assertions_on_result_states,
clippy::branches_sharing_code,
clippy::cfg_not_test,
clippy::clear_with_drain,
clippy::clone_on_ref_ptr,
clippy::collection_is_never_read,
Expand Down Expand Up @@ -85,6 +88,7 @@
clippy::rest_pat_in_fully_bound_structs,
clippy::same_name_method,
clippy::semicolon_inside_block,
clippy::set_contains_or_insert,
clippy::shadow_unrelated,
clippy::significant_drop_in_scrutinee,
clippy::significant_drop_tightening,
Expand Down

0 comments on commit 88d7c71

Please sign in to comment.