From 3ce1156ef24e702c684f5b0ff6656a21aafb52fb Mon Sep 17 00:00:00 2001 From: Caio Date: Fri, 3 May 2024 23:09:51 -0300 Subject: [PATCH] Update toolchain --- .github/workflows/ci.yaml | 4 ++-- ndstruct/src/coo.rs | 2 +- ndstruct/src/csl.rs | 2 +- ndstruct/src/utils.rs | 2 +- rust-toolchain | 2 +- rust-tools/README.md | 2 +- rust-tools/src/cfg/you_rust.rs | 7 ++++++- rust-tools/src/main.rs | 2 +- rust-tools/src/params.rs | 2 +- rust-tools/src/parse_cfg.rs | 4 ++-- 10 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 85aa018..42075f5 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -14,7 +14,7 @@ jobs: with: override: true profile: minimal - toolchain: nightly-2023-10-15 + toolchain: nightly-2024-04-27 - uses: actions-rs/install@v0.1 with: crate: cargo-fuzz @@ -31,7 +31,7 @@ jobs: components: clippy, rustfmt override: true profile: minimal - toolchain: nightly-2023-10-15 + toolchain: nightly-2024-04-27 - uses: Swatinem/rust-cache@v2 - run: .scripts/all.sh \ No newline at end of file diff --git a/ndstruct/src/coo.rs b/ndstruct/src/coo.rs index 84e1bad..27c6574 100644 --- a/ndstruct/src/coo.rs +++ b/ndstruct/src/coo.rs @@ -239,6 +239,6 @@ where let dims = crate::utils::valid_random_dims(rng, upper_bound); let max_nnz = crate::utils::max_nnz(&dims); let nnz = if max_nnz == 0 { 0 } else { rng.gen_range(0..max_nnz) }; - Self::new_controlled_random_rand(dims, nnz, rng, |r, _| r.gen()) + Self::new_controlled_random_rand(dims, nnz, rng, |r, _| r.r#gen()) } } diff --git a/ndstruct/src/csl.rs b/ndstruct/src/csl.rs index e1276be..1f25b19 100644 --- a/ndstruct/src/csl.rs +++ b/ndstruct/src/csl.rs @@ -610,6 +610,6 @@ where let dims = crate::utils::valid_random_dims(rng, upper_bound); let max_nnz = max_nnz(&dims); let nnz = if max_nnz == 0 { 0 } else { rng.gen_range(0..max_nnz) }; - Self::new_controlled_random_rand(dims, nnz, rng, |r, _| r.gen()) + Self::new_controlled_random_rand(dims, nnz, rng, |r, _| r.r#gen()) } } diff --git a/ndstruct/src/utils.rs b/ndstruct/src/utils.rs index aa1bae9..4446c74 100644 --- a/ndstruct/src/utils.rs +++ b/ndstruct/src/utils.rs @@ -94,5 +94,5 @@ where #[inline] pub(crate) fn windows2(slice: &[T]) -> impl Iterator { - slice.windows(2).filter_map(|value| Some([value.get(0)?, value.get(1)?])) + slice.windows(2).filter_map(|value| Some([value.first()?, value.get(1)?])) } diff --git a/rust-toolchain b/rust-toolchain index 729f380..a6354f4 100644 --- a/rust-toolchain +++ b/rust-toolchain @@ -1,4 +1,4 @@ [toolchain] -channel = "nightly-2023-10-15" +channel = "nightly-2024-04-27" components = ["clippy", "miri", "rustfmt"] profile = "minimal" diff --git a/rust-tools/README.md b/rust-tools/README.md index cf051ef..d65dfd8 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-2023-10-15 +toolchain nightly-2024-04-27 ``` ## CLI parameters diff --git a/rust-tools/src/cfg/you_rust.rs b/rust-tools/src/cfg/you_rust.rs index 347e3d3..0d85c31 100644 --- a/rust-tools/src/cfg/you_rust.rs +++ b/rust-tools/src/cfg/you_rust.rs @@ -7,6 +7,7 @@ const CLIPPY_FLAGS: &[&str] = &[ "-Aclippy::absolute_paths", "-Aclippy::big_endian_bytes", "-Aclippy::blanket-clippy-restriction-lints", + "-Aclippy::decimal_literal_representation", "-Aclippy::default_numeric_fallback", "-Aclippy::doc_markdown", "-Aclippy::error_impl_error", @@ -17,11 +18,14 @@ const CLIPPY_FLAGS: &[&str] = &[ "-Aclippy::ignored_unit_patterns", "-Aclippy::impl_trait_in_params", "-Aclippy::implicit_return", + "-Aclippy::inline_always", + "-Aclippy::integer_division_remainder_used", "-Aclippy::integer_division", "-Aclippy::into_iter_without_iter", "-Aclippy::len_without_is_empty", "-Aclippy::let_underscore_untyped", "-Aclippy::little_endian_bytes", + "-Aclippy::manual_assert", "-Aclippy::many_single_char_names", "-Aclippy::min_ident_chars", "-Aclippy::missing_assert_message", @@ -32,6 +36,7 @@ const CLIPPY_FLAGS: &[&str] = &[ "-Aclippy::multiple_inherent_impl", "-Aclippy::multiple_unsafe_ops_per_block", "-Aclippy::must_use_candidate", + "-Aclippy::needless_doctest_main", "-Aclippy::needless_else", "-Aclippy::non_ascii_literal", "-Aclippy::partial_pub_fields", @@ -46,6 +51,7 @@ const CLIPPY_FLAGS: &[&str] = &[ "-Aclippy::std_instead_of_core", "-Aclippy::str_to_string", "-Aclippy::struct_excessive_bools", + "-Aclippy::struct_field_names", "-Aclippy::unneeded_field_pattern", "-Aclippy::unseparated_literal_suffix", "-Aclippy::unused_self", @@ -84,7 +90,6 @@ const RUST_FLAGS: &[&str] = &[ "-Dunused_macro_rules", "-Dunused_qualifications", "-Dunused_results", - "-Dunused_tuple_struct_fields", "-Dwarnings", ]; diff --git a/rust-tools/src/main.rs b/rust-tools/src/main.rs index f2d6a19..1bee9e8 100644 --- a/rust-tools/src/main.rs +++ b/rust-tools/src/main.rs @@ -81,7 +81,7 @@ fn handle_cmd_output(cmd: &mut Command) -> Result<()> { write_stdio!(child_stdout, stdout()); } if !child.wait()?.success() { - return Err(crate::Error::FailedCommand); + return Err(Error::FailedCommand); } Ok(()) } diff --git a/rust-tools/src/params.rs b/rust-tools/src/params.rs index a24c476..ac7e041 100644 --- a/rust-tools/src/params.rs +++ b/rust-tools/src/params.rs @@ -14,7 +14,7 @@ impl Params { manage_flags(&mut self.rust_flags, &tp.add_rust_flags, &tp.rm_rust_flags); manage_flags(&mut self.rustfmt_flags, &tp.add_rustfmt_flags, &tp.rm_rustfmt_flags); if !tp.toolchain.is_empty() { - self.toolchain = tp.toolchain.clone(); + self.toolchain.clone_from(&tp.toolchain); } } } diff --git a/rust-tools/src/parse_cfg.rs b/rust-tools/src/parse_cfg.rs index 13ba421..359f9de 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-2023-10-15 + toolchain nightly-2024-04-27 "#; 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-2023-10-15"); + assert_eq!(tp.toolchain, "nightly-2024-04-27"); } }