refactor(paroxysm): Explicitly macro imports, no more 'extern crate'
Removes all but one occurence of `extern crate`, to conform with Rust 2018. The last one is necessary because Diesel is a giant jungle of complicated macros re-exported from private crates, and the current version makes it hard to import those directly instead. Change-Id: Id14165a456d5c3ce6f7a4e0222c611640113eb11 Reviewed-on: https://cl.tvl.fyi/c/depot/+/1549 Tested-by: BuildkiteCI Reviewed-by: kanepyork <rikingcoding@gmail.com>
This commit is contained in:
parent
660a02947f
commit
194c498d53
5 changed files with 16 additions and 19 deletions
|
@ -7,5 +7,10 @@ pkgs.naersk.buildPackage {
|
||||||
name = "paroxysm";
|
name = "paroxysm";
|
||||||
version = "0.0.1";
|
version = "0.0.1";
|
||||||
src = ./.;
|
src = ./.;
|
||||||
buildInputs = [pkgs.openssl pkgs.pkgconfig pkgs.postgresql.lib];
|
|
||||||
|
buildInputs = with pkgs; [
|
||||||
|
openssl
|
||||||
|
pkgconfig
|
||||||
|
postgresql.lib
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
use std::collections::HashSet;
|
use std::collections::HashSet;
|
||||||
|
use serde_derive::Deserialize; // TODO(tazjin): move away from serde_derive
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct Config {
|
pub struct Config {
|
||||||
|
|
|
@ -2,6 +2,7 @@ use crate::models::{Entry, Keyword, NewEntry, NewKeyword};
|
||||||
use diesel::pg::PgConnection;
|
use diesel::pg::PgConnection;
|
||||||
use diesel::prelude::*;
|
use diesel::prelude::*;
|
||||||
use failure::Error;
|
use failure::Error;
|
||||||
|
use failure::format_err;
|
||||||
use std::borrow::Cow;
|
use std::borrow::Cow;
|
||||||
|
|
||||||
/// Maximum number of times we'll follow a `see: ` pointer.
|
/// Maximum number of times we'll follow a `see: ` pointer.
|
||||||
|
|
|
@ -1,27 +1,16 @@
|
||||||
extern crate irc;
|
// TODO(tazjin): Upgrade to a Diesel version with public derive
|
||||||
extern crate serde;
|
// macros.
|
||||||
#[macro_use]
|
#[macro_use] extern crate diesel;
|
||||||
extern crate serde_derive;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate diesel;
|
|
||||||
extern crate chrono;
|
|
||||||
extern crate config;
|
|
||||||
extern crate env_logger;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate log;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate failure;
|
|
||||||
extern crate regex;
|
|
||||||
#[macro_use]
|
|
||||||
extern crate lazy_static;
|
|
||||||
extern crate rand;
|
|
||||||
|
|
||||||
use crate::cfg::Config;
|
use crate::cfg::Config;
|
||||||
use crate::keyword::KeywordDetails;
|
use crate::keyword::KeywordDetails;
|
||||||
use diesel::pg::PgConnection;
|
use diesel::pg::PgConnection;
|
||||||
use diesel::r2d2::{ConnectionManager, Pool};
|
use diesel::r2d2::{ConnectionManager, Pool};
|
||||||
use failure::Error;
|
use failure::Error;
|
||||||
|
use failure::format_err;
|
||||||
use irc::client::prelude::*;
|
use irc::client::prelude::*;
|
||||||
|
use lazy_static::lazy_static;
|
||||||
|
use log::{debug, info, warn};
|
||||||
use rand::rngs::ThreadRng;
|
use rand::rngs::ThreadRng;
|
||||||
use rand::{thread_rng, Rng};
|
use rand::{thread_rng, Rng};
|
||||||
use regex::{Captures, Regex};
|
use regex::{Captures, Regex};
|
||||||
|
@ -275,6 +264,7 @@ impl App {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn handle_privmsg(&mut self, from: &str, chan: &str, msg: &str) -> Result<(), Error> {
|
pub fn handle_privmsg(&mut self, from: &str, chan: &str, msg: &str) -> Result<(), Error> {
|
||||||
|
// TODO(tazjin): Move these to the top.
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
static ref LEARN_RE: Regex =
|
static ref LEARN_RE: Regex =
|
||||||
Regex::new(r#"^\?\?(?P<gen>!)?\s*(?P<subj>[^\[:]*):\s*(?P<val>.*)"#).unwrap();
|
Regex::new(r#"^\?\?(?P<gen>!)?\s*(?P<subj>[^\[:]*):\s*(?P<val>.*)"#).unwrap();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
use crate::schema::{entries, keywords};
|
|
||||||
use chrono::NaiveDateTime;
|
use chrono::NaiveDateTime;
|
||||||
|
use crate::schema::{entries, keywords};
|
||||||
|
|
||||||
#[derive(Queryable)]
|
#[derive(Queryable)]
|
||||||
pub struct Keyword {
|
pub struct Keyword {
|
||||||
|
|
Loading…
Reference in a new issue