Skip to content

Commit

Permalink
chore: cargo fix --edition-idioms
Browse files Browse the repository at this point in the history
  • Loading branch information
pjenvey committed Jan 7, 2019
1 parent 00592dd commit 909965f
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 57 deletions.
22 changes: 11 additions & 11 deletions src/db/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn has_connected_this_month(user: &DynamoDbUser) -> bool {
/// A blocking list_tables call only called during initialization
/// (prior to an any active tokio executor)
pub fn list_tables_sync(
ddb: Rc<Box<DynamoDb>>,
ddb: Rc<Box<dyn DynamoDb>>,
start_key: Option<String>,
) -> Result<ListTablesOutput> {
let input = ListTablesInput {
Expand All @@ -52,7 +52,7 @@ pub fn list_tables_sync(
}

pub fn fetch_messages(
ddb: Rc<Box<DynamoDb>>,
ddb: Rc<Box<dyn DynamoDb>>,
metrics: &Rc<StatsdClient>,
table_name: &str,
uaid: &Uuid,
Expand Down Expand Up @@ -116,7 +116,7 @@ pub fn fetch_messages(
}

pub fn fetch_timestamp_messages(
ddb: Rc<Box<DynamoDb>>,
ddb: Rc<Box<dyn DynamoDb>>,
metrics: &Rc<StatsdClient>,
table_name: &str,
uaid: &Uuid,
Expand Down Expand Up @@ -175,7 +175,7 @@ pub fn fetch_timestamp_messages(
}

pub fn drop_user(
ddb: Rc<Box<DynamoDb>>,
ddb: Rc<Box<dyn DynamoDb>>,
uaid: &Uuid,
router_table_name: &str,
) -> impl Future<Item = DeleteItemOutput, Error = Error> {
Expand All @@ -192,7 +192,7 @@ pub fn drop_user(
}

pub fn get_uaid(
ddb: Rc<Box<DynamoDb>>,
ddb: Rc<Box<dyn DynamoDb>>,
uaid: &Uuid,
router_table_name: &str,
) -> impl Future<Item = GetItemOutput, Error = Error> {
Expand All @@ -210,7 +210,7 @@ pub fn get_uaid(
}

pub fn register_user(
ddb: Rc<Box<DynamoDb>>,
ddb: Rc<Box<dyn DynamoDb>>,
user: &DynamoDbUser,
router_table: &str,
) -> impl Future<Item = PutItemOutput, Error = Error> {
Expand Down Expand Up @@ -251,7 +251,7 @@ pub fn register_user(
}

pub fn update_user_message_month(
ddb: Rc<Box<DynamoDb>>,
ddb: Rc<Box<dyn DynamoDb>>,
uaid: &Uuid,
router_table_name: &str,
message_month: &str,
Expand Down Expand Up @@ -281,7 +281,7 @@ pub fn update_user_message_month(
}

pub fn all_channels(
ddb: Rc<Box<DynamoDb>>,
ddb: Rc<Box<dyn DynamoDb>>,
uaid: &Uuid,
message_table_name: &str,
) -> impl Future<Item = HashSet<String>, Error = Error> {
Expand Down Expand Up @@ -314,7 +314,7 @@ pub fn all_channels(
}

pub fn save_channels(
ddb: Rc<Box<DynamoDb>>,
ddb: Rc<Box<dyn DynamoDb>>,
uaid: &Uuid,
channels: HashSet<String>,
message_table_name: &str,
Expand Down Expand Up @@ -347,7 +347,7 @@ pub fn save_channels(
}

pub fn unregister_channel_id(
ddb: Rc<Box<DynamoDb>>,
ddb: Rc<Box<dyn DynamoDb>>,
uaid: &Uuid,
channel_id: &Uuid,
message_table_name: &str,
Expand Down Expand Up @@ -375,7 +375,7 @@ pub fn unregister_channel_id(
}

pub fn lookup_user(
ddb: Rc<Box<DynamoDb>>,
ddb: Rc<Box<dyn DynamoDb>>,
metrics: &Rc<StatsdClient>,
uaid: &Uuid,
connected_at: &u64,
Expand Down
6 changes: 3 additions & 3 deletions src/db/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ pub enum RegisterResponse {
}

pub struct DynamoStorage {
ddb: Rc<Box<DynamoDb>>,
ddb: Rc<Box<dyn DynamoDb>>,
metrics: Rc<StatsdClient>,
router_table_name: String,
message_table_names: Vec<String>,
Expand All @@ -69,7 +69,7 @@ pub struct DynamoStorage {

impl DynamoStorage {
pub fn from_opts(opts: &ServerOptions, metrics: StatsdClient) -> Result<Self> {
let ddb: Box<DynamoDb> = if let Ok(endpoint) = env::var("AWS_LOCAL_DYNAMODB") {
let ddb: Box<dyn DynamoDb> = if let Ok(endpoint) = env::var("AWS_LOCAL_DYNAMODB") {
Box::new(DynamoDbClient::new_with(
HttpClient::new().chain_err(|| "TLS initialization error")?,
StaticProvider::new_minimal("BogusKey".to_string(), "BogusKey".to_string()),
Expand Down Expand Up @@ -421,7 +421,7 @@ impl DynamoStorage {
}
}

pub fn list_message_tables(ddb: &Rc<Box<DynamoDb>>, prefix: &str) -> Result<Vec<String>> {
pub fn list_message_tables(ddb: &Rc<Box<dyn DynamoDb>>, prefix: &str) -> Result<Vec<String>> {
let mut names: Vec<String> = Vec::new();
let mut start_key = None;
loop {
Expand Down
4 changes: 2 additions & 2 deletions src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ error_chain! {
}

errors {
Thread(payload: Box<Any + Send>) {
Thread(payload: Box<dyn Any + Send>) {
description("thread panicked")
}

Expand All @@ -77,7 +77,7 @@ error_chain! {
}
}

pub type MyFuture<T> = Box<Future<Item = T, Error = Error>>;
pub type MyFuture<T> = Box<dyn Future<Item = T, Error = Error>>;

pub trait FutureChainErr<T> {
fn chain_err<F, E>(self, callback: F) -> MyFuture<T>
Expand Down
2 changes: 1 addition & 1 deletion src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ impl Service for Push {
type Request = hyper::Request;
type Response = hyper::Response;
type Error = hyper::Error;
type Future = Box<Future<Item = hyper::Response, Error = hyper::Error>>;
type Future = Box<dyn Future<Item = hyper::Response, Error = hyper::Error>>;

fn call(&self, req: hyper::Request) -> Self::Future {
let mut response = hyper::Response::new();
Expand Down
72 changes: 36 additions & 36 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,60 +43,60 @@
//! Otherwise be sure to check out each module for more documentation!
// `error_chain!` can recurse deeply
#![recursion_limit = "1024"]
extern crate base64;
extern crate bytes;
extern crate cadence;
extern crate chan_signal;
extern crate chrono;
extern crate config;
extern crate docopt;
extern crate fernet;
use base64;

use cadence;


use config;


#[macro_use]
extern crate futures;
extern crate futures_backoff;
extern crate hex;
extern crate httparse;
extern crate hyper;

use hex;
use httparse;
use hyper;
#[macro_use]
extern crate lazy_static;
extern crate libc;

#[macro_use]
extern crate matches;
extern crate mozsvc_common;
extern crate openssl;
extern crate rand;
extern crate regex;
extern crate reqwest;
extern crate rusoto_core;
extern crate rusoto_credential;
extern crate rusoto_dynamodb;
use mozsvc_common;



use reqwest;



#[macro_use]
extern crate sentry;
extern crate serde;

#[macro_use]
extern crate serde_derive;
extern crate serde_dynamodb;
use serde_dynamodb;
#[macro_use]
extern crate serde_json;
#[macro_use]
extern crate slog;
extern crate slog_async;
extern crate slog_mozlog_json;
use slog_async;

#[macro_use]
extern crate slog_scope;
extern crate slog_stdlog;
extern crate slog_term;
use slog_stdlog;
use slog_term;
#[macro_use]
extern crate state_machine_future;
extern crate time;
extern crate tokio_core;
extern crate tokio_io;
extern crate tokio_openssl;
extern crate tokio_service;
extern crate tokio_tungstenite;
extern crate tungstenite;
extern crate uuid;
extern crate woothee;
use time;

use tokio_io;



use tungstenite;
use uuid;


#[macro_use]
extern crate error_chain;
Expand Down
6 changes: 3 additions & 3 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#[macro_use]
extern crate serde_derive;
extern crate autopush;
extern crate chan_signal;
extern crate docopt;

use chan_signal;


use std::env;

Expand Down
2 changes: 1 addition & 1 deletion src/util/rc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ impl<T> RcObject<T> {
RcObject(Rc::new(RefCell::new(t)))
}

pub fn borrow_mut(&self) -> RefMut<T> {
pub fn borrow_mut(&self) -> RefMut<'_, T> {
self.0.borrow_mut()
}
}
Expand Down

0 comments on commit 909965f

Please sign in to comment.