Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 4 additions & 40 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ on:
default: 0.20.0
cargo_audit_ignores:
type: string
default: ''
default: ""
description: Comma-delimited list of RUSTSEC CVE identifiers to ignore during audit.

env:
RUSTC_WRAPPER: sccache
SCCACHE_GHA_ENABLED: true
CARGO_TERM_COLOR: always

jobs:
Expand All @@ -28,7 +26,6 @@ jobs:
with:
key: ${{ runner.os }}-${{ github.workflow }}-${{ inputs.cache_version }}-rust-${{ github.job }}-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}-${{ github.sha }}
path: |
~/.cache/sccache
~/.cargo/bin/
~/.cargo/registry/cache/
~/.cargo/registry/index/
Expand Down Expand Up @@ -60,16 +57,10 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl
# easily install any rust bins without building them
- uses: cargo-bins/cargo-binstall@main
# install cargo-auditable to produce the binary
- run: cargo binstall -y cargo-auditable
# install sccache (compilation cache)
- uses: mozilla-actions/sccache-action@v0.0.4
# install mold (linker)
- uses: rui314/setup-mold@v1
- run: ld --version
# build
- run: mold -run cargo auditable build --target x86_64-unknown-linux-musl --all-targets --release --bins

test:
Expand All @@ -80,7 +71,6 @@ jobs:
with:
key: ${{ runner.os }}-${{ github.workflow }}-${{ inputs.cache_version }}-rust-${{ github.job }}-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}-${{ github.sha }}
path: |
~/.cache/sccache
~/.cargo/bin/
~/.cargo/registry/cache/
~/.cargo/registry/index/
Expand All @@ -90,14 +80,9 @@ jobs:
${{ runner.os }}-${{ github.workflow }}-${{ inputs.cache_version }}-rust-${{ github.job }}-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}-
${{ runner.os }}-${{ github.workflow }}-${{ inputs.cache_version }}-rust-${{ github.job }}-
- uses: dtolnay/rust-toolchain@stable
# easily install any rust bins without building them
- uses: cargo-bins/cargo-binstall@main
# install sccache (compilation cache)
- uses: mozilla-actions/sccache-action@v0.0.4
# install mold (linker)
- uses: rui314/setup-mold@v1
- run: ld --version
# test
- run: mold -run cargo test --workspace

format:
Expand All @@ -108,7 +93,6 @@ jobs:
with:
key: ${{ runner.os }}-${{ github.workflow }}-${{ inputs.cache_version }}-rust-${{ github.job }}-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}-${{ github.sha }}
path: |
~/.cache/sccache
~/.cargo/bin/
~/.cargo/registry/cache/
~/.cargo/registry/index/
Expand All @@ -120,28 +104,20 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
components: clippy, rustfmt
# also install nightly regardless
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: nightly
components: clippy, rustfmt
# easily install any rust bins without building them
- uses: cargo-bins/cargo-binstall@main
# install sccache (compilation cache)
- uses: mozilla-actions/sccache-action@v0.0.4
# install mold (linker)
- uses: rui314/setup-mold@v1
- run: ld --version
# cargo check
- name: check
run: mold -run cargo check --all-targets --all-features --tests
# cargo fmt
- name: cargo fmt
run: mold -run cargo +nightly fmt --all --check
# cargo clippy
- name: cargo clippy
run: mold -run cargo clippy --all-targets --all-features --tests -- -D warnings

audit:
runs-on: ubuntu-latest
steps:
Expand All @@ -150,7 +126,6 @@ jobs:
with:
key: ${{ runner.os }}-${{ github.workflow }}-${{ inputs.cache_version }}-rust-${{ github.job }}-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}-${{ github.sha }}
path: |
~/.cache/sccache
~/.cargo/bin/
~/.cargo/registry/cache/
~/.cargo/registry/index/
Expand All @@ -160,13 +135,8 @@ jobs:
${{ runner.os }}-${{ github.workflow }}-${{ inputs.cache_version }}-rust-${{ github.job }}-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}-
${{ runner.os }}-${{ github.workflow }}-${{ inputs.cache_version }}-rust-${{ github.job }}-
- uses: dtolnay/rust-toolchain@stable
# easily install any rust bins without building them
- uses: cargo-bins/cargo-binstall@main
# install cargo-auditable to produce the binary
- run: cargo binstall -y cargo-deny --locked
# install sccache (compilation cache)
- uses: mozilla-actions/sccache-action@v0.0.4
# install mold (linker)
- run: cargo binstall -y cargo-deny --locked
- uses: rui314/setup-mold@v1
- run: ld --version
- name: bans licenses sources
Expand All @@ -182,7 +152,6 @@ jobs:
with:
key: ${{ runner.os }}-${{ github.workflow }}-${{ inputs.cache_version }}-rust-${{ github.job }}-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}-${{ github.sha }}
path: |
~/.cache/sccache
~/.cargo/bin/
~/.cargo/registry/cache/
~/.cargo/registry/index/
Expand All @@ -194,13 +163,8 @@ jobs:
- uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
# easily install any rust bins without building them
- uses: cargo-bins/cargo-binstall@main
# install cargo-auditable to produce the binary
- run: cargo binstall -y trunk
# install sccache (compilation cache)
- uses: mozilla-actions/sccache-action@v0.0.4
# install mold (linker)
- run: cargo binstall -y trunk
- uses: rui314/setup-mold@v1
- run: ld --version
- name: trunk build
Expand Down
23 changes: 12 additions & 11 deletions deny.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,18 @@ ignore = ["RUSTSEC-2024-0384"]

[licenses]
allow = [
"AGPL-3.0",
"Apache-2.0",
"MIT",
"Zlib",
"BSL-1.0",
"MPL-2.0",
"ISC",
"CC0-1.0",
"BSD-3-Clause",
"BSD-2-Clause",
"Unicode-DFS-2016",
"AGPL-3.0",
"AGPL-3.0-or-later",
"Apache-2.0",
"MIT",
"Zlib",
"BSL-1.0",
"MPL-2.0",
"ISC",
"CC0-1.0",
"BSD-3-Clause",
"BSD-2-Clause",
"Unicode-DFS-2016",
]

[bans]
Expand Down
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
cargo
rust-analyzer
rustfmt
clippy
rustc
lld
graphviz
Expand Down
2 changes: 1 addition & 1 deletion src/bones/face.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl Face {
self.0.len()
}

pub fn iter(&self) -> std::slice::Iter<usize> {
pub fn iter(&self) -> std::slice::Iter<'_, usize> {
self.0.iter()
}

Expand Down
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![allow(dead_code)]

mod bones;
mod render;
use iced::futures::executor::block_on;
Expand Down
75 changes: 36 additions & 39 deletions src/render/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,46 +351,43 @@ impl ApplicationHandler for App<'_> {
WindowEvent::CloseRequested => {
event_loop.exit();
}
WindowEvent::KeyboardInput { event, .. } => {
if event.state.is_pressed() {
let Some(key) = &event.text else {
return;
};

let message = if key.as_str() == key.to_uppercase().as_str() {
use PresetMessage::*;
match key.to_lowercase().as_str() {
// Presets
"t" => Some(Pyramid(3)),
"c" => Some(Prism(4)),
"o" => Some(Octahedron),
"d" => Some(Dodecahedron),
"i" => Some(Icosahedron),
_ => None,
}
.map(PolybladeMessage::Preset)
} else {
use ConwayMessage::*;
match key.as_str() {
// Operations
"e" => Some(Expand),
"d" => Some(Dual),
"s" => Some(Snub),
"k" => Some(Kis),
"j" => Some(Join),
"a" => Some(Ambo),
"t" => Some(Truncate),
"b" => Some(Bevel),
_ => None,
}
.map(PolybladeMessage::Conway)
};

if let (Some(message), Some(AppData { state, .. })) =
(message, &mut self.data)
{
state.queue_message(message);
WindowEvent::KeyboardInput { event, .. } if event.state.is_pressed() => {
let Some(key) = &event.text else {
return;
};

let message = if key.as_str() == key.to_uppercase().as_str() {
use PresetMessage::*;
match key.to_lowercase().as_str() {
// Presets
"t" => Some(Pyramid(3)),
"c" => Some(Prism(4)),
"o" => Some(Octahedron),
"d" => Some(Dodecahedron),
"i" => Some(Icosahedron),
_ => None,
}
.map(PolybladeMessage::Preset)
} else {
use ConwayMessage::*;
match key.as_str() {
// Operations
"e" => Some(Expand),
"d" => Some(Dual),
"s" => Some(Snub),
"k" => Some(Kis),
"j" => Some(Join),
"a" => Some(Ambo),
"t" => Some(Truncate),
"b" => Some(Bevel),
_ => None,
}
.map(PolybladeMessage::Conway)
};

if let (Some(message), Some(AppData { state, .. })) = (message, &mut self.data)
{
state.queue_message(message);
}
}
WindowEvent::CursorMoved { position, .. } => {
Expand Down
2 changes: 1 addition & 1 deletion src/render/controls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl Program for Controls {
message.process(&mut self.state)
}

fn view(&self) -> Element<Self::Message, Self::Theme, Self::Renderer> {
fn view(&self) -> Element<'_, Self::Message, Self::Theme, Self::Renderer> {
let mut button_row = Row::new().spacing(10);
for (i, color) in self
.state
Expand Down
Loading