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 diff --git a/src/course_database.rs b/src/course_database.rs index 0ccd569..e91d1d5 100644 --- a/src/course_database.rs +++ b/src/course_database.rs @@ -1,9 +1,7 @@ use anyhow::anyhow; use core::str::FromStr; -use petgraph::graph::{DiGraph, NodeIndex}; -use petgraph::Graph; +use petgraph::graph::{Graph, NodeIndex}; use serde::Deserialize; -use std::collections::HashMap; use std::fmt; use std::io::BufReader; @@ -41,7 +39,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 2cb4b94..14e459e 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};