Repository: j0ru/kickoff (language: rust)

Issue:
Cleanup and CI
- [x] Fix all clippy problems
- [x] Create github workflow for testing and clippy


Discussion / hints:

Fix patch:
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..608fe4e
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,32 @@
+on:
+  push:
+    branches:
+      - main
+  pull_request:
+
+name: Continuous Integration
+
+jobs:
+  linux:
+    name: linux
+    runs-on: ubuntu-latest
+    strategy:
+      matrix:
+        rust:
+          - stable
+          - 1.54.0
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions-rs/toolchain@v1
+        with:
+          profile: minimal
+          toolchain: ${{ matrix.rust }}
+          override: true
+      - run: rustup component add clippy
+      - run: sudo apt-get install -y libfontconfig-dev pkgconf
+
+      - name: clippy
+        uses: actions-rs/cargo@v1
+        with:
+          command: clippy
+          args: -- -D warnings
diff --git a/src/gui.rs b/src/gui.rs
index 5350cb5..7430881 100644
--- a/src/gui.rs
+++ b/src/gui.rs
@@ -190,7 +190,7 @@ pub fn register_inputs(
     event_loop: &calloop::EventLoop<DData>,
 ) {
     for seat in seats {
-        if let Some((has_ptr, _name)) = with_seat_data(&seat, |seat_data| {
+        if let Some((has_ptr, _name)) = with_seat_data(seat, |seat_data| {
             (
                 seat_data.has_pointer && !seat_data.defunct,
                 seat_data.name.clone(),
@@ -204,7 +204,7 @@ pub fn register_inputs(
     }
 
     for seat in seats {
-        if let Some((has_kbd, name)) = with_seat_data(&seat, |seat_data| {
+        if let Some((has_kbd, name)) = with_seat_data(seat, |seat_data| {
             (
                 seat_data.has_keyboard && !seat_data.defunct,
                 seat_data.name.clone(),
@@ -213,7 +213,7 @@ pub fn register_inputs(
             if has_kbd {
                 if let Err(err) = map_keyboard_repeat(
                     event_loop.handle(),
-                    &seat,
+                    seat,
                     None,
                     RepeatKind::System,
                     move |event, _, ddata| process_keyboard_event(event, ddata),
diff --git a/src/history.rs b/src/history.rs
index 401600c..8823a03 100644
--- a/src/history.rs
+++ b/src/history.rs
@@ -64,7 +64,7 @@ fn encode_history(history: &HashMap<String, usize>) -> String {
         if n > &0 {
             res.push_str(&n.to_string());
             res.push(' ');
-            res.push_str(&p);
+            res.push_str(p);
             res.push('\n');
         }
     }
diff --git a/src/keybinds.rs b/src/keybinds.rs
index 0e1907b..277a2b7 100644
--- a/src/keybinds.rs
+++ b/src/keybinds.rs
@@ -69,7 +69,7 @@ pub struct KeyCombo {
 impl Keybindings {
     pub fn get(&self, modifiers: &ModifiersState, keysym: u32) -> Option<&Action> {
         self.inner.get(&KeyCombo {
-            modifiers: Modifiers(modifiers.clone()),
+            modifiers: Modifiers(*modifiers),
             key: keysym,
         })
     }
@@ -109,7 +109,7 @@ impl<'de> Visitor<'de> for KeyComboVisitor {
     {
         let mut modifiers = ModifiersState::default();
         let mut key: Option<u32> = None;
-        value.split("+").for_each(|s| match s {
+        value.split('+').for_each(|s| match s {
             "ctrl" => modifiers.ctrl = true,
             "shift" => modifiers.shift = true,
             "alt" => modifiers.alt = true,
diff --git a/src/main.rs b/src/main.rs
index d335569..d72b420 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -260,7 +260,7 @@ async fn run() -> Result<Option<JoinHandle<()>>, Box<dyn Error>> {
                     &config.colors.text_query
                 };
                 font.render(
-                    &query,
+                    query,
                     color,
                     &mut img,
                     config.padding + prompt_width,
@@ -289,7 +289,7 @@ async fn run() -> Result<Option<JoinHandle<()>>, Box<dyn Error>> {
                     &config.colors.text
                 };
                 font.render(
-                    &matched,
+                    matched,
                     color,
                     &mut img,
                     config.padding,
@@ -353,7 +353,7 @@ fn fuzzy_sort<'a>(
         .map(|x| {
             (
                 matcher
-                    .fuzzy_match(&x, &pattern)
+                    .fuzzy_match(x, pattern)
                     .map(|score| score + *pre_scored.get(x).unwrap_or(&1) as i64),
                 x,
             )


Test patch: