From 59a4c44ca4af5d66b57854796ce1757c981ff1dc Mon Sep 17 00:00:00 2001 From: Michael Lamparski Date: Wed, 14 May 2025 21:36:37 -0400 Subject: [PATCH 1/4] fix various warnings Closes #72 Closes #73 --- derive/src/lib.rs | 11 ++++++++--- src/serialize/mod.rs | 4 +--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/derive/src/lib.rs b/derive/src/lib.rs index 68a0482..afb5766 100644 --- a/derive/src/lib.rs +++ b/derive/src/lib.rs @@ -238,7 +238,9 @@ fn gen_field_dtypes_struct( } } -// from the wonderful folks working on serde +// from the wonderful folks working on serde. +// By placing our generated impls inside a `const`, we can freely use `use` +// and `extern crate` without them leaking into the module. fn wrap_in_const( trait_: &str, ty: &syn::Ident, @@ -250,10 +252,13 @@ fn wrap_in_const( ); quote! { - #[allow(non_upper_case_globals, unused_attributes, unused_qualifications)] + #[allow(non_upper_case_globals)] + #[allow(unused_attributes)] + #[allow(unused_qualifications)] + #[allow(non_local_definitions)] // this warns on the impl-in-a-const technique, lol const #dummy_const: () = { #[allow(unknown_lints)] - #[cfg_attr(feature = "cargo-clippy", allow(useless_attribute))] + #[clippy::allow(useless_attribute)] #[allow(rust_2018_idioms)] extern crate npyz as _npyz; diff --git a/src/serialize/mod.rs b/src/serialize/mod.rs index 1eb3490..5cfe95c 100644 --- a/src/serialize/mod.rs +++ b/src/serialize/mod.rs @@ -13,13 +13,11 @@ use traits::{helper, ErrorKind}; #[macro_use] mod traits; -pub use slice::*; +pub use slice::FixedSizeBytes; mod slice; -pub use primitive::*; mod primitive; -pub use array_member::*; mod array_member; // helpers From c147987a1b6a491d04a8902fe3e0b2df72067cd6 Mon Sep 17 00:00:00 2001 From: Michael Lamparski Date: Wed, 14 May 2025 21:44:36 -0400 Subject: [PATCH 2/4] fix re-export of zip dependency This formerly relied on the implicit feature generated by the 'zip' optional dependency, which seemed like a more reliable indicator of whether the crate should be exported. Unfortunately you can't write `#[cfg(feature = "dep:zip")]`. XD --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index f057e3b..0e3e959 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -286,7 +286,7 @@ pub mod type_matchup_docs; pub use num_complex; #[cfg(feature = "arrayvec")] pub use arrayvec; -#[cfg(feature = "zip")] +#[cfg(feature = "npz")] pub use zip; #[cfg(feature = "half")] pub use half; From 07bbb60b70e32257a92d95e9c3199ab673d86914 Mon Sep 17 00:00:00 2001 From: Michael Lamparski Date: Wed, 14 May 2025 21:59:59 -0400 Subject: [PATCH 3/4] get clippy syntax right --- derive/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/derive/src/lib.rs b/derive/src/lib.rs index afb5766..9e4ada8 100644 --- a/derive/src/lib.rs +++ b/derive/src/lib.rs @@ -258,7 +258,7 @@ fn wrap_in_const( #[allow(non_local_definitions)] // this warns on the impl-in-a-const technique, lol const #dummy_const: () = { #[allow(unknown_lints)] - #[clippy::allow(useless_attribute)] + #[allow(clippy::useless_attribute)] #[allow(rust_2018_idioms)] extern crate npyz as _npyz; From 1cdb39f4d2b167111b65d6f597398177a9a40a47 Mon Sep 17 00:00:00 2001 From: Michael Lamparski Date: Wed, 14 May 2025 22:10:46 -0400 Subject: [PATCH 4/4] 0.8.4 --- CHANGELOG.md | 10 +++++++++- Cargo.toml | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cca4e8f..f37759a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 No unreleased changes yet! +## [0.8.4] - 2025-05-14 + +### Changed +- Bug fix: `impl AutoSerialize for Complex` now properly generates types `c8` and `c16` instead of `c4` and `c8`. Thanks @calder! +- Bug fix: The public dependency `zip` is now properly re-exported. +- Fixes some warnings generated by the `#[derive(...)]` macros in newer rust versions. + ## [0.8.3] - 2023-12-23 ### Added @@ -106,7 +113,8 @@ This is an extremely minor update that just updates the README. - Adds `NpyReader` for reading from an `io::Read` - Adds `Builder` and `NpyWriter` for writing to an `io::Write` -[Unreleased]: https://github.com/ExpHP/npyz/compare/0.8.3...HEAD +[Unreleased]: https://github.com/ExpHP/npyz/compare/0.8.4...HEAD +[0.8.4]: https://github.com/ExpHP/npyz/compare/0.8.3...0.8.4 [0.8.3]: https://github.com/ExpHP/npyz/compare/0.8.2...0.8.3 [0.8.2]: https://github.com/ExpHP/npyz/compare/0.8.1...0.8.2 [0.8.1]: https://github.com/ExpHP/npyz/compare/0.8.0...0.8.1 diff --git a/Cargo.toml b/Cargo.toml index a972f3f..286cd5f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "npyz" -version = "0.8.3" +version = "0.8.4" edition = "2021" authors = [ "Michael Lamparski ",