about summary refs log tree commit diff
path: root/fun
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-08-02T00·31+0100
committertazjin <mail@tazj.in>2020-08-02T21·57+0000
commitde27b3c1ff7ef347d14a1b361156fedbfd8f8558 (patch)
tree365f81fa0906eee75a90ca04411093085b56d890 /fun
parent1faab130040a3bcb205cf682c8b39ac881ad9b3e (diff)
style(paroxysm): Apply rustfmt r/1551
Change-Id: I959b6a1008f1b0ef632c0194adc0f680e7c27d62
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1561
Tested-by: BuildkiteCI
Reviewed-by: kanepyork <rikingcoding@gmail.com>
Diffstat (limited to 'fun')
-rw-r--r--fun/paroxysm/src/cfg.rs2
-rw-r--r--fun/paroxysm/src/keyword.rs2
-rw-r--r--fun/paroxysm/src/main.rs30
-rw-r--r--fun/paroxysm/src/models.rs2
4 files changed, 18 insertions, 18 deletions
diff --git a/fun/paroxysm/src/cfg.rs b/fun/paroxysm/src/cfg.rs
index 1f19c8aadc..cfb2e2073e 100644
--- a/fun/paroxysm/src/cfg.rs
+++ b/fun/paroxysm/src/cfg.rs
@@ -1,5 +1,5 @@
-use std::collections::HashSet;
 use serde::Deserialize;
+use std::collections::HashSet;
 
 #[derive(Deserialize)]
 pub struct Config {
diff --git a/fun/paroxysm/src/keyword.rs b/fun/paroxysm/src/keyword.rs
index 16d962ab05..7bbc8cadf6 100644
--- a/fun/paroxysm/src/keyword.rs
+++ b/fun/paroxysm/src/keyword.rs
@@ -1,8 +1,8 @@
 use crate::models::{Entry, Keyword, NewEntry, NewKeyword};
 use diesel::pg::PgConnection;
 use diesel::prelude::*;
-use failure::Error;
 use failure::format_err;
+use failure::Error;
 use std::borrow::Cow;
 
 /// Maximum number of times we'll follow a `see: ` pointer.
diff --git a/fun/paroxysm/src/main.rs b/fun/paroxysm/src/main.rs
index 081f273bad..7bfdf8cb43 100644
--- a/fun/paroxysm/src/main.rs
+++ b/fun/paroxysm/src/main.rs
@@ -1,13 +1,14 @@
 // TODO(tazjin): Upgrade to a Diesel version with public derive
 // macros.
-#[macro_use] extern crate diesel;
+#[macro_use]
+extern crate diesel;
 
 use crate::cfg::Config;
 use crate::keyword::KeywordDetails;
 use diesel::pg::PgConnection;
 use diesel::r2d2::{ConnectionManager, Pool};
-use failure::Error;
 use failure::format_err;
+use failure::Error;
 use irc::client::prelude::*;
 use lazy_static::lazy_static;
 use log::{debug, info, warn};
@@ -25,19 +26,14 @@ mod schema;
 lazy_static! {
     static ref LEARN_RE: Regex =
         Regex::new(r#"^\?\?(?P<gen>!)?\s*(?P<subj>[^\[:]*):\s*(?P<val>.*)"#).unwrap();
-
     static ref QUERY_RE: Regex =
         Regex::new(r#"^\?\?\s*(?P<subj>[^\[:]*)(?P<idx>\[[^\]]+\])?"#).unwrap();
-
     static ref QLAST_RE: Regex = Regex::new(r#"^\?\?\s*(?P<subj>[^\[:]*)!"#).unwrap();
-
     static ref INCREMENT_RE: Regex =
-        Regex::new(r#"^\?\?(?P<gen>!)?\s*(?P<subj>[^\[:]*)(?P<incrdecr>\+\+|\-\-)"#)
-        .unwrap();
-
-    static ref MOVE_RE: Regex = Regex::new(
-        r#"^\?\?(?P<gen>!)?\s*(?P<subj>[^\[:]*)(?P<idx>\[[^\]]+\])->(?P<new_idx>.*)"#
-    ).unwrap();
+        Regex::new(r#"^\?\?(?P<gen>!)?\s*(?P<subj>[^\[:]*)(?P<incrdecr>\+\+|\-\-)"#).unwrap();
+    static ref MOVE_RE: Regex =
+        Regex::new(r#"^\?\?(?P<gen>!)?\s*(?P<subj>[^\[:]*)(?P<idx>\[[^\]]+\])->(?P<new_idx>.*)"#)
+            .unwrap();
 }
 
 pub struct App {
@@ -159,9 +155,12 @@ impl App {
             if last.starts_with("\x01ACTION ") {
                 // Yes, this is inefficient, but it's better than writing some hacky CTCP parsing code
                 // I guess (also, characters are hard, so just blindly slicing seems like a bad idea)
-                format!("* {} {}", nick_to_grab, last.replace("\x01ACTION ", "").replace("\x01", ""))
-            }
-            else {
+                format!(
+                    "* {} {}",
+                    nick_to_grab,
+                    last.replace("\x01ACTION ", "").replace("\x01", "")
+                )
+            } else {
                 format!("<{}> {}", nick_to_grab, last)
             }
         } else {
@@ -195,7 +194,8 @@ impl App {
         }
         if let Some((i, val)) = idx {
             kwd.update(i, &val.to_string(), &db)?;
-            self.client.send_notice(target, kwd.format_entry(i).unwrap())?;
+            self.client
+                .send_notice(target, kwd.format_entry(i).unwrap())?;
         } else {
             let val = if is_incr { 1 } else { -1 };
             let idx = kwd.learn(nick, &val.to_string(), &db)?;
diff --git a/fun/paroxysm/src/models.rs b/fun/paroxysm/src/models.rs
index 734a248e8f..721efbbb2e 100644
--- a/fun/paroxysm/src/models.rs
+++ b/fun/paroxysm/src/models.rs
@@ -1,5 +1,5 @@
-use chrono::NaiveDateTime;
 use crate::schema::{entries, keywords};
+use chrono::NaiveDateTime;
 
 #[derive(Queryable)]
 pub struct Keyword {