tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 788HTML 740Markdown 12TOML 62536 Definiciones

Setup basic ci (#7)

* add CI with github actions

* format

* clippy

72bb512efa5b659d18e34b991ecbfe004909a008 · por François · (hace 4 años) · padre b73467601 · ver el árbol en este commit

Delta semántico · 4

src/style.rs

3 archivos · +68 −18

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 000000000..51e280c97
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,64 @@
+on: [push, pull_request]
+
+name: Continuous integration
+
+jobs:
+  check:
+    name: Check
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions-rs/toolchain@v1
+        with:
+          profile: minimal
+          toolchain: stable
+          override: true
+      - uses: actions-rs/cargo@v1
+        with:
+          command: check
+
+  test:
+    name: Test Suite
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions-rs/toolchain@v1
+        with:
+          profile: minimal
+          toolchain: stable
+          override: true
+      - uses: actions-rs/cargo@v1
+        with:
+          command: test
+
+  fmt:
+    name: Rustfmt
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions-rs/toolchain@v1
+        with:
+          profile: minimal
+          toolchain: stable
+          override: true
+      - run: rustup component add rustfmt
+      - uses: actions-rs/cargo@v1
+        with:
+          command: fmt
+          args: --all -- --check
+
+  clippy:
+    name: Clippy
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions-rs/toolchain@v1
+        with:
+          profile: minimal
+          toolchain: stable
+          override: true
+      - run: rustup component add clippy
+      - uses: actions-rs/cargo@v1
+        with:
+          command: clippy
+          args: -- -D warnings
\ No newline at end of file
diff --git a/benches/complex.rs b/benches/complex.rs
index 28c57938c..ba2d5ec2d 100644
--- a/benches/complex.rs
+++ b/benches/complex.rs
@@ -109,7 +109,6 @@ fn build_deep_hierarchy(stretch: &mut stretch2::node::Stretch) -> stretch2::node
     let node22 = stretch.new_node(stretch2::style::Style { ..Default::default() }, &[node221, node222]).unwrap();
 
     let node2 = stretch.new_node(stretch2::style::Style { ..Default::default() }, &[node21, node22]).unwrap();
-    
 
     stretch.new_node(stretch2::style::Style { ..Default::default() }, &[node1, node2]).unwrap()
 }
diff --git a/src/style.rs b/src/style.rs
index 0dbcb7a58..a3dcd7a86 100644
--- a/src/style.rs
+++ b/src/style.rs
@@ -112,26 +112,17 @@ impl Default for FlexDirection {
 impl FlexDirection {
     #[inline]
     pub(crate) fn is_row(self) -> bool {
-        match self {
-            Self::Row | Self::RowReverse => true,
-            _ => false,
-        }
+        matches!(self, Self::Row | Self::RowReverse)
     }
 
     #[inline]
     pub(crate) fn is_column(self) -> bool {
-        match self {
-            Self::Column | Self::ColumnReverse => true,
-            _ => false,
-        }
+        matches!(self, Self::Column | Self::ColumnReverse)
     }
 
     #[inline]
     pub(crate) fn is_reverse(self) -> bool {
-        match self {
-            Self::RowReverse | Self::ColumnReverse => true,
-            _ => false,
-        }
+        matches!(self, Self::RowReverse | Self::ColumnReverse)
     }
 }
 
@@ -228,11 +219,7 @@ impl Dimension {
     }
 
     pub(crate) fn is_defined(self) -> bool {
-        match self {
-            Dimension::Points(_) => true,
-            Dimension::Percent(_) => true,
-            _ => false,
-        }
+        matches!(self, Dimension::Points(_) | Dimension::Percent(_))
     }
 }