From e1043bbecafa0b64fa7c212c8e655169573debe1 Mon Sep 17 00:00:00 2001 From: Caio Date: Wed, 11 Sep 2024 08:44:34 -0300 Subject: [PATCH] Updates --- .github/workflows/ci.yaml | 4 +-- Cargo.lock | 44 ++++++++++++++------------ cl-aux/src/traits/with_capacity.rs | 50 +++++++++++++++--------------- ndstruct/src/csl.rs | 13 ++++---- rust-toolchain | 2 +- rust-tools/README.md | 2 +- rust-tools/src/cfg/you_rust.rs | 6 +++- rust-tools/src/parse_cfg.rs | 4 +-- 8 files changed, 67 insertions(+), 58 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 5cbac57..2b81d88 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,7 +14,7 @@ jobs: with: override: true profile: minimal - toolchain: nightly-2024-07-10 + toolchain: nightly-2024-09-07 - uses: actions-rs/install@v0.1 with: crate: cargo-fuzz @@ -31,7 +31,7 @@ jobs: components: clippy, rustfmt override: true profile: minimal - toolchain: nightly-2024-07-10 + toolchain: nightly-2024-09-07 - uses: Swatinem/rust-cache@v2 - run: .scripts/all.sh \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 48afdf7..18e481e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -13,19 +13,19 @@ dependencies = [ [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "cc" -version = "1.1.0" +version = "1.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaff6f8ce506b9773fa786672d63fc7a191ffea1be33f72bbd4aeacefca9ffc8" +checksum = "b62ac837cdb5cb22e10a256099b4fc502b1dfe560cb282963a974d7abd80e476" dependencies = [ "jobserver", "libc", - "once_cell", + "shlex", ] [[package]] @@ -82,18 +82,18 @@ checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "jobserver" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" dependencies = [ "libc", ] [[package]] name = "libc" -version = "0.2.155" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libfuzzer-sys" @@ -144,9 +144,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" dependencies = [ "proc-macro2", ] @@ -192,24 +192,30 @@ version = "1.0.3" [[package]] name = "serde" -version = "1.0.204" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc76f558e0cbb2a839d37354c575f1dc3fdc6546b5be373ba43d95f231bf7c12" +checksum = "c8e3592472072e6e22e0a54d5904d9febf8508f65fb8552499a1abc7d1078c3a" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.204" +version = "1.0.210" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0cd7e117be63d3c3678776753929474f3b04a43a080c744d6b0ae2a8c28e222" +checksum = "243902eda00fad750862fc144cea25caca5e20d615af0a81bee94ca738f1df1f" dependencies = [ "proc-macro2", "quote", "syn", ] +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + [[package]] name = "smallvec" version = "1.13.2" @@ -218,9 +224,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "syn" -version = "2.0.70" +version = "2.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f0209b68b3613b093e0ec905354eccaedcfe83b8cb37cbdeae64026c3064c16" +checksum = "9f35bcdf61fd8e7be6caf75f429fdca8beb3ed76584befb503b1569faee373ed" dependencies = [ "proc-macro2", "quote", @@ -244,6 +250,6 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "unicode-ident" -version = "1.0.12" +version = "1.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" diff --git a/cl-aux/src/traits/with_capacity.rs b/cl-aux/src/traits/with_capacity.rs index a8b6415..8595e7a 100644 --- a/cl-aux/src/traits/with_capacity.rs +++ b/cl-aux/src/traits/with_capacity.rs @@ -12,13 +12,13 @@ where type Input; /// Creates a new instance based on an initial holding capacity provided by `Input`. - fn with_capacity(input: Self::Input) -> Self; + fn with_capacity(input: Self::Input) -> Result; } /// ```rust /// use cl_aux::Capacity; /// let structure: [i32; 5]; -/// structure = cl_aux::WithCapacity::with_capacity(0); +/// structure = cl_aux::WithCapacity::with_capacity(0).unwrap(); /// assert_eq!(structure.capacity(), 5); /// ``` impl WithCapacity for [T; N] @@ -29,13 +29,13 @@ where type Input = usize; #[inline] - fn with_capacity(_: Self::Input) -> Self { - [(); N].map(|_| T::default()) + fn with_capacity(_: Self::Input) -> Result { + Ok([(); N].map(|_| T::default())) } } /// ```rust -/// let structure: String = cl_aux::WithCapacity::with_capacity(2); +/// let structure: String = cl_aux::WithCapacity::with_capacity(2).unwrap(); /// assert_eq!(structure.capacity(), 2); /// ``` #[cfg(feature = "alloc")] @@ -44,13 +44,13 @@ impl WithCapacity for String { type Input = usize; #[inline] - fn with_capacity(input: Self::Input) -> Self { - String::with_capacity(input) + fn with_capacity(input: Self::Input) -> Result { + Ok(String::with_capacity(input)) } } /// ```rust -/// let structure: Vec = cl_aux::WithCapacity::with_capacity(2); +/// let structure: Vec = cl_aux::WithCapacity::with_capacity(2).unwrap(); /// assert_eq!(structure.capacity(), 2); /// ``` #[cfg(feature = "alloc")] @@ -59,14 +59,14 @@ impl WithCapacity for Vec { type Input = usize; #[inline] - fn with_capacity(input: Self::Input) -> Self { - Vec::with_capacity(input) + fn with_capacity(input: Self::Input) -> Result { + Ok(Vec::with_capacity(input)) } } /// ```rust /// let structure: arrayvec::ArrayString<5>; -/// structure = cl_aux::WithCapacity::with_capacity(0); +/// structure = cl_aux::WithCapacity::with_capacity(0).unwrap(); /// assert_eq!(structure.capacity(), 5); /// ``` #[cfg(feature = "arrayvec")] @@ -75,14 +75,14 @@ impl WithCapacity for arrayvec::ArrayString { type Input = usize; #[inline] - fn with_capacity(_: Self::Input) -> Self { - arrayvec::ArrayString::new() + fn with_capacity(_: Self::Input) -> Result { + Ok(arrayvec::ArrayString::new()) } } /// ```rust /// let structure: arrayvec::ArrayVec; -/// structure = cl_aux::WithCapacity::with_capacity(0); +/// structure = cl_aux::WithCapacity::with_capacity(0).unwrap(); /// assert_eq!(structure.capacity(), 5); /// ``` #[cfg(feature = "arrayvec")] @@ -91,14 +91,14 @@ impl WithCapacity for arrayvec::ArrayVec { type Input = usize; #[inline] - fn with_capacity(_: Self::Input) -> Self { - arrayvec::ArrayVec::new() + fn with_capacity(_: Self::Input) -> Result { + Ok(arrayvec::ArrayVec::new()) } } /// ```rust /// let structure: smallvec::SmallVec<[i32; 5]>; -/// structure = cl_aux::WithCapacity::with_capacity(0); +/// structure = cl_aux::WithCapacity::with_capacity(0).unwrap(); /// assert_eq!(structure.capacity(), 5); /// ``` #[cfg(feature = "smallvec")] @@ -110,14 +110,14 @@ where type Input = usize; #[inline] - fn with_capacity(input: Self::Input) -> Self { - smallvec::SmallVec::with_capacity(input) + fn with_capacity(input: Self::Input) -> Result { + Ok(smallvec::SmallVec::with_capacity(input)) } } /// ```rust /// let mut structure = cl_aux::doc_tests::tiny_vec_array_vec(); -/// structure = cl_aux::WithCapacity::with_capacity(0); +/// structure = cl_aux::WithCapacity::with_capacity(0).unwrap(); /// assert_eq!(structure.capacity(), 5); /// ``` #[cfg(feature = "tinyvec")] @@ -130,14 +130,14 @@ where type Input = usize; #[inline] - fn with_capacity(_: Self::Input) -> Self { - tinyvec::ArrayVec::new() + fn with_capacity(_: Self::Input) -> Result { + Ok(tinyvec::ArrayVec::new()) } } /// ```rust /// let mut structure = cl_aux::doc_tests::tiny_vec_tiny_vec(); -/// structure = cl_aux::WithCapacity::with_capacity(0); +/// structure = cl_aux::WithCapacity::with_capacity(0).unwrap(); /// assert_eq!(structure.capacity(), 5); /// ``` #[cfg(all(feature = "alloc", feature = "tinyvec"))] @@ -150,7 +150,7 @@ where type Input = usize; #[inline] - fn with_capacity(input: Self::Input) -> Self { - tinyvec::TinyVec::with_capacity(input) + fn with_capacity(input: Self::Input) -> Result { + Ok(tinyvec::TinyVec::with_capacity(input)) } } diff --git a/ndstruct/src/csl.rs b/ndstruct/src/csl.rs index 445c5ab..52a889f 100644 --- a/ndstruct/src/csl.rs +++ b/ndstruct/src/csl.rs @@ -92,14 +92,13 @@ where /// let _ = CslVec::::with_capacity(nnz, nolp1); /// ``` #[inline] - #[must_use] - pub fn with_capacity(nnz: usize, nolp1: usize) -> Self { - Self { - data: DS::with_capacity(nnz), + pub fn with_capacity(nnz: usize, nolp1: usize) -> crate::Result { + Ok(Self { + data: DS::with_capacity(nnz)?, dims: <_>::default(), - indcs: IS::with_capacity(nnz), - offs: OS::with_capacity(nolp1), - } + indcs: IS::with_capacity(nnz)?, + offs: OS::with_capacity(nolp1)?, + }) } } diff --git a/rust-toolchain b/rust-toolchain index 07fefb4..57c548b 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,4 +1,4 @@ [toolchain] -channel = "nightly-2024-07-10" +channel = "nightly-2024-09-07" components = ["clippy", "miri", "rustfmt"] profile = "minimal" diff --git a/rust-tools/README.md b/rust-tools/README.md index 49a93ec..4cfae25 100644 --- a/rust-tools/README.md +++ b/rust-tools/README.md @@ -63,7 +63,7 @@ rust-tools --file SOME_CONFIGURATION_FILE.cfg SOME_COMMAND add_clipy_flags -Aclippy::type_complexity rm_clippy_flags -Aclippy::implicit_return,-Aclippy::missing_docs_in_private_items template you-rust -toolchain nightly-2024-07-10 +toolchain nightly-2024-09-07 ``` ## CLI parameters diff --git a/rust-tools/src/cfg/you_rust.rs b/rust-tools/src/cfg/you_rust.rs index 7539d94..dde451e 100644 --- a/rust-tools/src/cfg/you_rust.rs +++ b/rust-tools/src/cfg/you_rust.rs @@ -8,8 +8,11 @@ const CLIPPY_FLAGS: &[&str] = &[ "-Aclippy::allow_attributes", "-Aclippy::big_endian_bytes", "-Aclippy::blanket-clippy-restriction-lints", + "-Aclippy::copy_iterator", "-Aclippy::decimal_literal_representation", "-Aclippy::default_numeric_fallback", + "-Aclippy::else_if_without_else", + "-Aclippy::enum_variant_names", "-Aclippy::error_impl_error", "-Aclippy::exhaustive_enums", "-Aclippy::exhaustive_structs", @@ -34,7 +37,6 @@ const CLIPPY_FLAGS: &[&str] = &[ "-Aclippy::multiple_inherent_impl", "-Aclippy::must_use_candidate", "-Aclippy::needless_doctest_main", - "-Aclippy::panic_in_result_fn", "-Aclippy::pattern_type_mismatch", "-Aclippy::pub_use", "-Aclippy::pub_with_shorthand", @@ -45,6 +47,8 @@ const CLIPPY_FLAGS: &[&str] = &[ "-Aclippy::similar_names", "-Aclippy::single_call_fn", "-Aclippy::struct_field_names", + "-Aclippy::too_long_first_doc_paragraph", + "-Aclippy::unneeded_field_pattern", "-Aclippy::unseparated_literal_suffix", "-Aclippy::used_underscore_binding", "-Aclippy::wildcard_enum_match_arm", diff --git a/rust-tools/src/parse_cfg.rs b/rust-tools/src/parse_cfg.rs index 07cbaf1..9d43d44 100644 --- a/rust-tools/src/parse_cfg.rs +++ b/rust-tools/src/parse_cfg.rs @@ -101,7 +101,7 @@ mod tests { rm_rust_flags E add_rustfmt_flags F template you-rust - toolchain nightly-2024-07-10 + toolchain nightly-2024-09-07 "#; let (params, tp) = parse_cfg(&cfg[..]).unwrap(); assert_eq!(params, YouRust::default().0); @@ -111,6 +111,6 @@ mod tests { assert_eq!(tp.rm_rust_flags, vec!["E"]); assert_eq!(tp.add_rustfmt_flags, vec!["F"]); assert_eq!(tp.rm_rustfmt_flags, Vec::::new()); - assert_eq!(tp.toolchain, "nightly-2024-07-10"); + assert_eq!(tp.toolchain, "nightly-2024-09-07"); } }