From 8fc4e083c9c5f1dce759461dc4c45e26151a3ad1 Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Mon, 5 Apr 2021 20:00:13 +0200 Subject: chore(web/converse): Apply 'cargo fix --edition' This does not yet change up `extern crate` and `macro_use` statements, but since we still depend on Diesel that also wouldn't work right now. Change-Id: I36de1b7b56f7d220f567346e13bad8da06461517 Reviewed-on: https://cl.tvl.fyi/c/depot/+/2858 Tested-by: BuildkiteCI Reviewed-by: tazjin --- web/converse/src/db.rs | 26 +++++++++++++------------- web/converse/src/errors.rs | 2 +- web/converse/src/handlers.rs | 14 +++++++------- web/converse/src/main.rs | 8 ++++---- web/converse/src/models.rs | 2 +- web/converse/src/oidc.rs | 2 +- web/converse/src/render.rs | 4 ++-- 7 files changed, 29 insertions(+), 29 deletions(-) (limited to 'web') diff --git a/web/converse/src/db.rs b/web/converse/src/db.rs index e20349944402..1d61595898fa 100644 --- a/web/converse/src/db.rs +++ b/web/converse/src/db.rs @@ -23,8 +23,8 @@ use diesel::{self, sql_query}; use diesel::sql_types::Text; use diesel::prelude::*; use diesel::r2d2::{Pool, ConnectionManager}; -use models::*; -use errors::{ConverseError, Result}; +use crate::models::*; +use crate::errors::{ConverseError, Result}; /// The DB actor itself. Several of these will be run in parallel by /// `SyncArbiter`. @@ -43,7 +43,7 @@ impl Handler for DbExecutor { type Result = ::Result; fn handle(&mut self, _: ListThreads, _: &mut Self::Context) -> Self::Result { - use schema::thread_index::dsl::*; + use crate::schema::thread_index::dsl::*; let conn = self.0.get()?; let results = thread_index @@ -67,8 +67,8 @@ impl Handler for DbExecutor { fn handle(&mut self, msg: LookupOrCreateUser, _: &mut Self::Context) -> Self::Result { - use schema::users; - use schema::users::dsl::*; + use crate::schema::users; + use crate::schema::users::dsl::*; let conn = self.0.get()?; @@ -104,8 +104,8 @@ impl Handler for DbExecutor { type Result = ::Result; fn handle(&mut self, msg: GetThread, _: &mut Self::Context) -> Self::Result { - use schema::threads::dsl::*; - use schema::simple_posts::dsl::id; + use crate::schema::threads::dsl::*; + use crate::schema::simple_posts::dsl::id; let conn = self.0.get()?; let thread_result: Thread = threads @@ -129,7 +129,7 @@ impl Handler for DbExecutor { type Result = ::Result; fn handle(&mut self, msg: GetPost, _: &mut Self::Context) -> Self::Result { - use schema::simple_posts::dsl::*; + use crate::schema::simple_posts::dsl::*; let conn = self.0.get()?; Ok(simple_posts.find(msg.id).first(&conn)?) } @@ -148,7 +148,7 @@ impl Handler for DbExecutor { type Result = Result; fn handle(&mut self, msg: UpdatePost, _: &mut Self::Context) -> Self::Result { - use schema::posts::dsl::*; + use crate::schema::posts::dsl::*; let conn = self.0.get()?; let updated = diesel::update(posts.find(msg.post_id)) .set(body.eq(msg.post)) @@ -169,8 +169,8 @@ impl Handler for DbExecutor { type Result = ::Result; fn handle(&mut self, msg: CreateThread, _: &mut Self::Context) -> Self::Result { - use schema::threads; - use schema::posts; + use crate::schema::threads; + use crate::schema::posts; let conn = self.0.get()?; @@ -204,12 +204,12 @@ impl Handler for DbExecutor { type Result = ::Result; fn handle(&mut self, msg: CreatePost, _: &mut Self::Context) -> Self::Result { - use schema::posts; + use crate::schema::posts; let conn = self.0.get()?; let closed: bool = { - use schema::threads::dsl::*; + use crate::schema::threads::dsl::*; threads.select(closed) .find(msg.0.thread_id) .first(&conn)? diff --git a/web/converse/src/errors.rs b/web/converse/src/errors.rs index 95b2366ce509..6b22f8d39aa5 100644 --- a/web/converse/src/errors.rs +++ b/web/converse/src/errors.rs @@ -66,7 +66,7 @@ pub enum ConverseError { // actix-web-compatible response errors, such as the errors it // throws itself. #[fail(display = "Actix response error: {}", error)] - Actix { error: Box }, + Actix { error: Box }, } // Establish conversion links to foreign errors: diff --git a/web/converse/src/handlers.rs b/web/converse/src/handlers.rs index d558afbe1242..d984fc71374b 100644 --- a/web/converse/src/handlers.rs +++ b/web/converse/src/handlers.rs @@ -29,15 +29,15 @@ use actix_web::http::Method; use actix_web::middleware::identity::RequestIdentity; use actix_web::middleware::{Started, Middleware}; use actix_web; -use db::*; -use errors::ConverseError; +use crate::db::*; +use crate::errors::ConverseError; use futures::Future; use mime_guess::guess_mime_type; -use models::*; -use oidc::*; -use render::*; +use crate::models::*; +use crate::oidc::*; +use crate::render::*; -type ConverseResponse = Box>; +type ConverseResponse = Box>; const HTML: &'static str = "text/html"; const ANONYMOUS: i32 = 1; @@ -288,7 +288,7 @@ pub fn login(state: State) -> ConverseResponse { /// otherwise a new user is created. pub fn callback(state: State, data: Form, - mut req: HttpRequest) -> ConverseResponse { + req: HttpRequest) -> ConverseResponse { state.oidc.send(RetrieveToken(data.0)).flatten() .map(|author| LookupOrCreateUser { email: author.email, diff --git a/web/converse/src/main.rs b/web/converse/src/main.rs index 5c8a188fc31b..061cfa6e7baf 100644 --- a/web/converse/src/main.rs +++ b/web/converse/src/main.rs @@ -73,13 +73,13 @@ use actix_web::*; use actix_web::http::Method; use actix_web::middleware::Logger; use actix_web::middleware::identity::{IdentityService, CookieIdentityPolicy}; -use db::*; +use crate::db::*; use diesel::pg::PgConnection; use diesel::r2d2::{ConnectionManager, Pool}; -use handlers::*; -use oidc::OidcExecutor; +use crate::handlers::*; +use crate::oidc::OidcExecutor; use rand::{OsRng, Rng}; -use render::Renderer; +use crate::render::Renderer; use std::env; fn config(name: &str) -> String { diff --git a/web/converse/src/models.rs b/web/converse/src/models.rs index 96eed419d359..da628f78b5bc 100644 --- a/web/converse/src/models.rs +++ b/web/converse/src/models.rs @@ -17,7 +17,7 @@ // . use chrono::prelude::{DateTime, Utc}; -use schema::{users, threads, posts, simple_posts}; +use crate::schema::{users, threads, posts, simple_posts}; use diesel::sql_types::{Text, Integer}; /// Represents a single user in the Converse database. Converse does diff --git a/web/converse/src/oidc.rs b/web/converse/src/oidc.rs index 849143596895..baa6e626c0ac 100644 --- a/web/converse/src/oidc.rs +++ b/web/converse/src/oidc.rs @@ -26,7 +26,7 @@ use actix::prelude::*; use reqwest; use url::Url; use url_serde; -use errors::*; +use crate::errors::*; /// This structure represents the contents of an OIDC discovery /// document. diff --git a/web/converse/src/render.rs b/web/converse/src/render.rs index 025a369ba5b5..cfc08377a6fc 100644 --- a/web/converse/src/render.rs +++ b/web/converse/src/render.rs @@ -22,10 +22,10 @@ use actix::prelude::*; use askama::Template; -use errors::*; +use crate::errors::*; use std::fmt; use md5; -use models::*; +use crate::models::*; use chrono::prelude::{DateTime, Utc}; use comrak::{ComrakOptions, markdown_to_html}; -- cgit 1.4.1