Skip to content

Commit

Permalink
more edition-2018 cleanups
Browse files Browse the repository at this point in the history
* remove "extern crate" and "macro_use"
* rearrange use statements
  • Loading branch information
warner committed Dec 6, 2018
1 parent dd79658 commit 4f4be69
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 25 deletions.
20 changes: 8 additions & 12 deletions examples/readline-core.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
use rustyline;

use ws;

use magic_wormhole::core::{
APIAction, APIEvent, Action, IOAction, IOEvent, OfferType, PeerMessage,
WSHandle, WormholeCore,
};

use parking_lot::{deadlock, Mutex};
use regex::Regex;
use rustyline;
use rustyline::{
completion::Completer, error::ReadlineError, highlight::Highlighter,
hint::Hinter, Helper,
};
use std::error::Error;
use std::io;
use std::sync::{
Expand All @@ -15,14 +17,8 @@ use std::sync::{
};
use std::thread::{sleep, spawn};
use std::time::Duration;

use parking_lot::{deadlock, Mutex};
use regex::Regex;
use rustyline::{
completion::Completer, error::ReadlineError, highlight::Highlighter,
hint::Hinter, Helper,
};
use url::Url;
use ws;

const MAILBOX_SERVER: &'static str = "ws://localhost:4000/v1";
const APPID: &'static str = "lothar.com/wormhole/text-or-file-xfer";
Expand Down
1 change: 0 additions & 1 deletion examples/receive-blocking.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use hex;

use magic_wormhole::core::{file_ack, message_ack, OfferType, PeerMessage};
use magic_wormhole::io::blocking::Wormhole;
use std::str;
Expand Down
1 change: 0 additions & 1 deletion examples/send-blocking.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use hex;

use magic_wormhole::core::message;
use magic_wormhole::io::blocking::Wormhole;

Expand Down
1 change: 1 addition & 0 deletions src/core/boss.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use super::api::Mood;
use super::events::{Code, Events, Nameplate, Phase};
use super::wordlist::default_wordlist;
use serde_json::json;
use std::str::FromStr;
use std::sync::Arc;

Expand Down
3 changes: 2 additions & 1 deletion src/core/key.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use hex;

use hkdf::Hkdf;
use serde_derive::{Deserialize, Serialize};
use serde_json::json;
use serde_json::{self, Value};
use sha2::{Digest, Sha256};
use sodiumoxide;
Expand Down
3 changes: 1 addition & 2 deletions src/core/rendezvous.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
// in Twisted, we delegate all of this to a ClientService, so there's a lot
// more code and more states here

use hex;

use super::api::{TimerHandle, WSHandle};
use super::events::{
AppID, Events, Mailbox, MySide, Nameplate, Phase, TheirSide,
Expand All @@ -17,6 +15,7 @@ use super::server_messages::{
add, allocate, bind, claim, close, deserialize, list, open, release,
InboundMessage, OutboundMessage,
};
use hex;
use serde_json;
// we process these
use super::api::IOEvent;
Expand Down
5 changes: 3 additions & 2 deletions src/core/server_messages.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use serde_json::{self, Value};

use super::api::Mood;
use super::events::{AppID, Mailbox, MySide};
use super::util;
use serde_derive::{Deserialize, Serialize};
use serde_json::{self, Value};

#[derive(Serialize, Deserialize, Debug, PartialEq)]
pub struct Nameplate {
Expand Down Expand Up @@ -123,6 +123,7 @@ mod test {
use super::*;
use crate::core::api::Mood;
use serde_json::from_str;
use serde_json::json;

#[test]
fn test_bind() {
Expand Down
3 changes: 2 additions & 1 deletion src/core/transfer.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use serde_json;
use serde_derive::{Deserialize, Serialize};
use serde_json::json;

#[derive(Deserialize, Serialize, Debug, PartialEq)]
#[serde(rename_all = "kebab-case")]
Expand Down
5 changes: 0 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
#![forbid(unsafe_code)]
#![deny(warnings)]

#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate serde_json;
use hex;

use sodiumoxide;

pub mod core;
Expand Down

0 comments on commit 4f4be69

Please sign in to comment.