gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 5544Rust 88Markdown 11TOML 91926 Definitions

Clippy (June 2025) (#852)

* Impl From<u16> rather than TryFrom<u16> for GridTrackRepetition

Signed-off-by: Nico Burns <nico@nicoburns.com>

* Use stable Rust for clippy

Signed-off-by: Nico Burns <nico@nicoburns.com>

---------

Signed-off-by: Nico Burns <nico@nicoburns.com>

88803395f6d3acf6d5d65ee6c87d020240fde79f · by Nico Burns · (1 year ago) · parent a31a40b47 · browse the tree at this commit

Semantic delta · 3

src/style/grid.rs

2 files · +5 −7

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index cc3133336..753a7f04a 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -227,9 +227,9 @@ jobs:
       - uses: actions/checkout@v4
       - uses: dtolnay/rust-toolchain@master
         with:
-          toolchain: nightly
+          toolchain: stable
           components: clippy
-      - run: cargo +nightly clippy --workspace -- -D warnings
+      - run: cargo clippy --workspace -- -D warnings
 
   # Run rustdoc with the `docsrs` cfg to ensure that the documentation is compatible with docs.rs.
   # This enables the doc_auto_cfg feature, which requires the nightly toolchain.
diff --git a/src/style/grid.rs b/src/style/grid.rs
index 41f5bd09b..38fd57a8f 100644
--- a/src/style/grid.rs
+++ b/src/style/grid.rs
@@ -9,7 +9,6 @@ use crate::style_helpers::*;
 use crate::util::sys::GridTrackVec;
 use core::borrow::Borrow;
 use core::cmp::{max, min};
-use core::convert::Infallible;
 
 /// The set of styles required for a CSS Grid container
 pub trait GridContainerStyle: CoreStyle {
@@ -953,10 +952,9 @@ pub enum GridTrackRepetition {
     /// The specified tracks should be repeated exacts N times
     Count(u16),
 }
-impl TryFrom<u16> for GridTrackRepetition {
-    type Error = Infallible;
-    fn try_from(value: u16) -> Result<Self, Infallible> {
-        Ok(Self::Count(value))
+impl From<u16> for GridTrackRepetition {
+    fn from(value: u16) -> Self {
+        Self::Count(value)
     }
 }