From c8805d11683aae66aa1df9bf2b215456c866aef6 Mon Sep 17 00:00:00 2001 From: Lucas Jansen <7199136+staticintlucas@users.noreply.github.com> Date: Mon, 10 Jun 2024 20:25:07 +0100 Subject: [PATCH] Bump MSRV --- .github/workflows/test.yml | 2 +- Cargo.toml | 2 +- README.md | 4 ++-- keyset-color/src/lib.rs | 14 ++++++-------- keyset-geom/src/path/arc_to_bezier.rs | 5 ++--- 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 99c63b4..33732af 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -31,7 +31,7 @@ jobs: strategy: fail-fast: false matrix: - rust: [stable, 1.70.0] + rust: [stable, 1.74.1] steps: - name: Checkout uses: actions/checkout@v4 diff --git a/Cargo.toml b/Cargo.toml index cbf19cc..1a9415e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,7 +14,7 @@ resolver = "2" version = "0.3.2" authors = ["Lucas Jansen"] edition = "2021" -rust-version = "1.70" +rust-version = "1.74" repository = "https://github.com/staticintlucas/keyset-rs" license = "MIT OR Apache-2.0" diff --git a/README.md b/README.md index 2446318..1866dc8 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [test status]: https://img.shields.io/github/actions/workflow/status/staticintlucas/keyset-rs/test.yml?branch=main&label=tests&style=flat-square [test coverage]: https://img.shields.io/codecov/c/gh/staticintlucas/keyset-rs?style=flat-square [crate version]: https://img.shields.io/crates/v/keyset?style=flat-square -[rust version]: https://img.shields.io/badge/rust-1.70%2B-informational?style=flat-square +[rust version]: https://img.shields.io/badge/rust-1.74%2B-informational?style=flat-square [actions]: https://github.com/staticintlucas/keyset-rs/actions?query=branch%3Amain [codecov]: https://app.codecov.io/github/staticintlucas/keyset-rs @@ -12,7 +12,7 @@ A (WIP) reimplementation of [pykeyset] in Rust for improved performance. Eventually this aims to become the backend for pykeyset using a Python wrapper around this project. -Current minimum supported Rust version is 1.70.0, although this is subject to change as development continues. +Current minimum supported Rust version is 1.74.0, although this is subject to change as development continues. [pykeyset]: https://github.com/staticintlucas/pykeyset diff --git a/keyset-color/src/lib.rs b/keyset-color/src/lib.rs index f96f6b0..f44ef3a 100644 --- a/keyset-color/src/lib.rs +++ b/keyset-color/src/lib.rs @@ -97,32 +97,30 @@ impl Color { #[inline] #[must_use] pub fn as_rgb8(&self) -> (u8, u8, u8) { - let [r, g, b] = self.0.map(|c| (c * 256.0).saturating_into()); - (r, g, b) + self.0.map(|c| (c * 256.0).saturating_into()).into() } /// Returns a tuple containing the red, green, and blue components as [`u16`]. #[inline] #[must_use] pub fn as_rgb16(&self) -> (u16, u16, u16) { - let [r, g, b] = self.0.map(|c| (c * 65536.0).saturating_into()); - (r, g, b) + self.0.map(|c| (c * 65536.0).saturating_into()).into() } /// Creates a new [`Color`] from a tuple containing the red, green, and blue /// components as [`u8`]. #[inline] #[must_use] - pub fn from_rgb8((r, g, b): (u8, u8, u8)) -> Self { - [r, g, b].map(|c| f32::from(c) / 255.0).into() + pub fn from_rgb8(rgb: (u8, u8, u8)) -> Self { + <[u8; 3]>::from(rgb).map(|c| f32::from(c) / 255.0).into() } /// Creates a new [`Color`] from a tuple containing the red, green, and blue /// components as [`u16`]. #[inline] #[must_use] - pub fn from_rgb16((r, g, b): (u16, u16, u16)) -> Self { - [r, g, b].map(|c| f32::from(c) / 65535.0).into() + pub fn from_rgb16(rgb: (u16, u16, u16)) -> Self { + <[u16; 3]>::from(rgb).map(|c| f32::from(c) / 65535.0).into() } /// Returns a slice containing the red, green, and blue components of the colour. diff --git a/keyset-geom/src/path/arc_to_bezier.rs b/keyset-geom/src/path/arc_to_bezier.rs index 2e7c272..6f630df 100644 --- a/keyset-geom/src/path/arc_to_bezier.rs +++ b/keyset-geom/src/path/arc_to_bezier.rs @@ -62,10 +62,9 @@ pub fn arc_to_bezier( (0..i_segments) .map(|i| phi0 + dphi * i.into()) // Starting angle for segment .map(|phi0| create_arc(r, phi0, dphi)) // Create segment arc - .map(|(ctrl1, ctrl2, point)| { + .map(|vecs| { // Re-rotate by xar - let [ctrl1, ctrl2, point] = [ctrl1, ctrl2, point].map(|p| p.rotate(xar)); - (ctrl1, ctrl2, point) + <[Vector<_>; 3]>::from(vecs).map(|p| p.rotate(xar)).into() }) .collect() }