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 1d56fd2 commit 815eee2
Show file tree
Hide file tree
Showing 13 changed files with 61 additions and 17 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ jobs:
strategy:
fail-fast: false
matrix:
msrv: ["1.62.0"]
msrv: ["1.81.0"]
os: ["ubuntu", "macOS", "windows"]
runs-on: ${{ matrix.os }}-latest
steps:
Expand Down
18 changes: 16 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ All user visible changes to this project will be documented in this file. This p



## [0.4.0] · 202?-??-??
[0.4.0]: /../../tree/v0.4.0

[Diff](/../../compare/v0.3.1...v0.4.0)

### BC Breaks

- Bumped up [MSRV] to 1.81 because for `#[expect]` attribute usage. ([todo])

[todo]: /../../commit/todo




## [0.3.1] · 2023-03-24
[0.3.1]: /../../tree/v0.3.1

Expand All @@ -27,7 +41,7 @@ All user visible changes to this project will be documented in this file. This p

### BC Breaks

- Set MSRV to [1.62.0](https://blog.rust-lang.org/2022/06/30/Rust-1.62.0.html). ([7f0b77e0])
- Set [MSRV] to [1.62.0](https://blog.rust-lang.org/2022/06/30/Rust-1.62.0.html). ([7f0b77e0])
- Upgrade [`syn`] to 2.0 version. ([90159de5])

[7f0b77e0]: /../../commit/7f0b77e0842edd7ecd18c91ec1e1b218711cc230
Expand Down Expand Up @@ -122,5 +136,5 @@ All user visible changes to this project will be documented in this file. This p

[`sealed`]: https://docs.rs/sealed
[`syn`]: https://docs.rs/syn

[MSRV]: https://doc.rust-lang.org/cargo/reference/manifest.html#the-rust-version-field
[Semantic Versioning 2.0.0]: https://semver.org
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 = "synthez"
version = "0.3.1"
edition = "2021"
rust-version = "1.62"
rust-version = "1.81"
description = "Steroids for `syn`, `quote` and `proc-macro2` crates."
authors = ["Kai Ren <[email protected]>"]
license = "BlueOak-1.0.0"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ synthez
=======

[![crates.io](https://img.shields.io/crates/v/synthez.svg "crates.io")](https://crates.io/crates/synthez)
[![Rust 1.62+](https://img.shields.io/badge/rustc-1.62+-lightgray.svg "Rust 1.62+")](https://blog.rust-lang.org/2022/06/30/Rust-1.62.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)
[![CI](https://github.com/arcane-rs/synthez/workflows/CI/badge.svg?branch=main "CI")](https://github.com/arcane-rs/synthez/actions?query=workflow%3ACI+branch%3Amain)
[![Rust docs](https://docs.rs/synthez/badge.svg "Rust docs")](https://docs.rs/synthez)
Expand Down
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 = "synthez-codegen"
version = "0.3.1"
edition = "2021"
rust-version = "1.62"
rust-version = "1.81"
description = "Internal codegen shim of `synthez` crate."
authors = ["Kai Ren <[email protected]>"]
license = "BlueOak-1.0.0"
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 @@ synthez-codegen
===============

[![crates.io](https://img.shields.io/crates/v/synthez-codegen.svg "crates.io")](https://crates.io/crates/synthez-codegen)
[![Rust 1.62+](https://img.shields.io/badge/rustc-1.62+-lightgray.svg "Rust 1.62+")](https://blog.rust-lang.org/2022/06/30/Rust-1.62.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/synthez-codegen/badge.svg "Rust docs")](https://docs.rs/synthez-codegen)

Expand Down
4 changes: 4 additions & 0 deletions codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,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 @@ -84,6 +87,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 = "synthez-core"
version = "0.3.1"
edition = "2021"
rust-version = "1.62"
rust-version = "1.81"
description = "Internal implementations of `synthez` crate."
authors = ["Kai Ren <[email protected]>"]
license = "BlueOak-1.0.0"
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 @@ synthez-core
============

[![crates.io](https://img.shields.io/crates/v/synthez-core.svg "crates.io")](https://crates.io/crates/synthez-core)
[![Rust 1.62+](https://img.shields.io/badge/rustc-1.62+-lightgray.svg "Rust 1.62+")](https://blog.rust-lang.org/2022/06/30/Rust-1.62.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/synthez-core/badge.svg "Rust docs")](https://docs.rs/synthez-core)

Expand Down
15 changes: 12 additions & 3 deletions core/src/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,10 @@ impl<T> Required<T> {
/// value.
#[must_use]
pub fn into_inner(self) -> T {
#[allow(clippy::expect_used)] // intentional
#[expect( // intentional
clippy::expect_used,
reason = "follows `Required` type semantics"
)]
self.0.expect("uninitialized `Required` value")
}

Expand All @@ -270,14 +273,20 @@ impl<T> Deref for Required<T> {
type Target = T;

fn deref(&self) -> &Self::Target {
#[allow(clippy::expect_used)] // intentional
#[expect( // intentional
clippy::expect_used,
reason = "follows `Required` type semantics"
)]
self.0.as_ref().expect("uninitialized `Required` value")
}
}

impl<T> DerefMut for Required<T> {
fn deref_mut(&mut self) -> &mut Self::Target {
#[allow(clippy::expect_used)] // intentional
#[expect( // intentional
clippy::expect_used,
reason = "follows `Required` type semantics"
)]
self.0.as_mut().expect("uninitialized `Required` value")
}
}
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, 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
17 changes: 13 additions & 4 deletions core/src/parse/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ impl<V: Attrs + Default + Parse> Attrs for Box<V> {

/// Filters the given `attrs` to contain [`syn::Attribute`]s only with the given
/// `name`.
#[allow(single_use_lifetimes)] // no other way
#[expect(single_use_lifetimes, reason = "no other way")]
pub fn filter_by_name<'n: 'ret, 'a: 'ret, 'ret>(
name: &'n str,
attrs: &'a [syn::Attribute],
Expand Down Expand Up @@ -435,7 +435,10 @@ pub mod field {
Self: TryApply<V, kind::Nested, D>,
{
fn try_apply_self(&mut self, another: Self) -> syn::Result<()> {
#[allow(clippy::iter_over_hash_type)] // order doesn't matter
#[expect( // order doesn't matter
clippy::iter_over_hash_type,
reason = "order doesn't matter here"
)]
for val in another {
self.try_apply(val)?;
}
Expand Down Expand Up @@ -489,7 +492,10 @@ pub mod field {
Self: TryApply<V, kind::Value, D>,
{
fn try_apply_self(&mut self, another: Self) -> syn::Result<()> {
#[allow(clippy::iter_over_hash_type)] // order doesn't matter
#[expect( // order doesn't matter
clippy::iter_over_hash_type,
reason = "order doesn't matter here"
)]
for val in another {
self.try_apply(val)?;
}
Expand Down Expand Up @@ -654,7 +660,10 @@ pub mod field {
Self: TryApply<(K, V), kind::Map, D>,
{
fn try_apply_self(&mut self, another: Self) -> syn::Result<()> {
#[allow(clippy::iter_over_hash_type)] // order doesn't matter
#[expect( // order doesn't matter
clippy::iter_over_hash_type,
reason = "order doesn't matter here"
)]
for val in another {
self.try_apply(val)?;
}
Expand Down
6 changes: 5 additions & 1 deletion 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 Expand Up @@ -147,7 +151,7 @@
)]

// TODO: Remove once docs render correctly without it.
#[allow(unused_imports)] // for correct Rust docs rendering only!
#[expect(unused_imports, reason = "for correct Rust docs rendering only!")]
use syn as _;

#[doc(inline)]
Expand Down

0 comments on commit 815eee2

Please sign in to comment.