From c34da4df11b98e55b083e273a2bd5946b445f879 Mon Sep 17 00:00:00 2001 From: Tadeo Kondrak Date: Sat, 2 Mar 2024 18:50:12 -0700 Subject: [PATCH 1/2] ci: init --- .github/workflows/ci.yml | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..1288fa7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +name: CI + +on: + push: + workflow_dispatch: + +env: + CI: 1 + RUST_BACKTRACE: short + RUSTFLAGS: -D warnings + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + - run: cargo test + lint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: clippy + - run: cargo clippy + fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + components: rustfmt + - uses: actions-rust-lang/rustfmt@v1 From b2d33a873d0827e81f6db473ceaf122a9f1d37d3 Mon Sep 17 00:00:00 2001 From: Tadeo Kondrak Date: Sat, 2 Mar 2024 18:58:15 -0700 Subject: [PATCH 2/2] refactor(main): Fix warnings --- src/course_database.rs | 3 +-- src/graph_widget.rs | 2 +- src/lib.rs | 2 ++ 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/course_database.rs b/src/course_database.rs index 6a12435..5b4152d 100644 --- a/src/course_database.rs +++ b/src/course_database.rs @@ -1,6 +1,5 @@ use anyhow::anyhow; use core::str::FromStr; -use petgraph::graph::DiGraph; use std::fmt; pub enum Requirement { @@ -22,7 +21,7 @@ impl FromStr for CourseId { fn from_str(value: &str) -> Result { let mut pieces = value .split_whitespace() - .filter(|string| string.trim_start().len() != 0); + .filter(|string| !string.trim_start().is_empty()); Ok(CourseId { subject_id: pieces diff --git a/src/graph_widget.rs b/src/graph_widget.rs index a9a72fd..7c4043e 100644 --- a/src/graph_widget.rs +++ b/src/graph_widget.rs @@ -42,7 +42,7 @@ where } fn state(&self) -> tree::State { - tree::State::new(State::default()) + tree::State::new(State) } fn size(&self) -> Size { diff --git a/src/lib.rs b/src/lib.rs index 4dbe33e..e803b30 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,3 +1,5 @@ +#![allow(dead_code, unused_variables)] + use iced::theme::Palette; use iced::widget::{button, column, container, horizontal_rule, row, text, text_input}; use iced::{executor, Application, Color, Command, Element, Length, Theme};