Reorganized imports into a consistent style.

This commit is contained in:
Aaron Weiss 2017-06-22 14:14:49 -04:00
parent eecbe1630c
commit ec8fdeb2e9
No known key found for this signature in database
GPG key ID: 0237035D9BF03AE2
10 changed files with 44 additions and 25 deletions

View file

@ -2,10 +2,7 @@
use std::fs::File;
use std::{fmt, io};
use std::io::Read;
use error;
use client::data::Config;
use client::transport::{IrcTransport, LogView, Logged};
use proto::{IrcCodec, Message};
use encoding::EncoderTrap;
use encoding::label::encoding_from_whatwg_label;
use futures::{Async, Poll, Future, Sink, StartSend, Stream};
@ -16,6 +13,11 @@ use tokio_io::AsyncRead;
use tokio_mockstream::MockStream;
use tokio_tls::{TlsConnectorExt, TlsStream};
use error;
use client::data::Config;
use client::transport::{IrcTransport, LogView, Logged};
use proto::{IrcCodec, Message};
/// An IRC connection used internally by `IrcServer`.
pub enum Connection {
#[doc(hidden)]

View file

@ -6,7 +6,9 @@ use std::io::prelude::*;
use std::io::{Error, ErrorKind};
use std::net::{SocketAddr, ToSocketAddrs};
use std::path::Path;
use serde_json;
use error::Result;
/// Configuration data.
@ -285,11 +287,12 @@ impl Config {
#[cfg(test)]
mod test {
use super::Config;
use std::collections::HashMap;
use std::default::Default;
use std::path::Path;
use super::Config;
#[test]
fn load() {
let cfg = Config {

View file

@ -3,6 +3,7 @@ use std::borrow::ToOwned;
use std::cmp::Ordering;
use std::cmp::Ordering::{Less, Equal, Greater};
use std::str::FromStr;
use proto::{Mode, ChannelMode};
/// IRC User data.
@ -226,8 +227,8 @@ impl Iterator for AccessLevelIterator {
mod test {
use super::{AccessLevel, User};
use super::AccessLevel::*;
use proto::Mode::*;
use proto::ChannelMode as M;
use proto::Mode::*;
#[test]
fn parse_access_level() {

View file

@ -4,13 +4,7 @@ use std::collections::HashMap;
use std::path::Path;
use std::sync::{Arc, Mutex, RwLock};
use std::thread;
use error;
use client::conn::Connection;
use client::data::{Config, User};
use client::server::utils::ServerExt;
use client::transport::LogView;
use proto::{ChannelMode, Command, Message, Mode, Response};
use proto::Command::{JOIN, NICK, NICKSERV, PART, PRIVMSG, ChannelMODE, QUIT};
use futures::{Async, Poll, Future, Sink, Stream};
use futures::stream::SplitStream;
use futures::sync::mpsc;
@ -20,6 +14,14 @@ use futures::sync::mpsc::UnboundedSender;
use time;
use tokio_core::reactor::Core;
use error;
use client::conn::Connection;
use client::data::{Config, User};
use client::server::utils::ServerExt;
use client::transport::LogView;
use proto::{ChannelMode, Command, Message, Mode, Response};
use proto::Command::{JOIN, NICK, NICKSERV, PART, PRIVMSG, ChannelMODE, QUIT};
pub mod utils;
/// An interface for interacting with an IRC server.
@ -555,17 +557,19 @@ impl IrcServer {
#[cfg(test)]
mod test {
use super::{IrcServer, Server};
use std::thread;
use std::time::Duration;
use std::collections::HashMap;
use std::default::Default;
use std::thread;
use std::time::Duration;
use futures::{Future, Stream};
use super::{IrcServer, Server};
use client::data::Config;
#[cfg(not(feature = "nochanlists"))]
use client::data::User;
use proto::{ChannelMode, Mode};
use proto::command::Command::{PART, PRIVMSG};
use futures::{Future, Stream};
pub fn test_config() -> Config {
Config {

View file

@ -1,13 +1,15 @@
//! Utilities and shortcuts for working with IRC servers.
use std::borrow::ToOwned;
#[cfg(feature = "ctcp")]
use time;
use error::Result;
use proto::{Capability, Command, Mode, NegotiationVersion};
use proto::command::CapSubCommand::{END, LS, REQ};
use proto::command::Command::*;
use proto::mode::ModeType;
use client::server::Server;
use proto::command::CapSubCommand::{END, LS, REQ};
#[cfg(feature = "ctcp")]
use time;
/// Extensions for Server capabilities that make it easier to work directly with the protocol.
pub trait ServerExt: Server {

View file

@ -2,13 +2,15 @@
use std::io;
use std::sync::{Arc, RwLock, RwLockReadGuard};
use std::time::Instant;
use error;
use client::data::Config;
use proto::{Command, IrcCodec, Message};
use futures::{Async, Poll, Sink, StartSend, Stream};
use tokio_io::{AsyncRead, AsyncWrite};
use tokio_io::codec::Framed;
use error;
use client::data::Config;
use proto::{Command, IrcCodec, Message};
/// An IRC transport that handles automatically replying to PINGs.
pub struct IrcTransport<T>
where

View file

@ -1,6 +1,7 @@
//! Enumeration of all available client commands.
use std::ascii::AsciiExt;
use std::str::FromStr;
use error;
use proto::{ChannelMode, Mode, Response, UserMode};

View file

@ -1,8 +1,9 @@
//! Implementation of IRC codec for Tokio.
use error;
use bytes::BytesMut;
use tokio_io::codec::{Decoder, Encoder};
use error;
use proto::line::LineCodec;
use proto::message::Message;

View file

@ -1,12 +1,14 @@
//! Implementation of line-delimiting codec for Tokio.
use std::io;
use error;
use bytes::{BufMut, BytesMut};
use encoding::{DecoderTrap, EncoderTrap, EncodingRef};
use encoding::label::encoding_from_whatwg_label;
use tokio_io::codec::{Decoder, Encoder};
use error;
/// A line-based codec parameterized by an encoding.
pub struct LineCodec {
encoding: EncodingRef,

View file

@ -2,6 +2,7 @@
use std::borrow::ToOwned;
use std::fmt::{Display, Formatter, Result as FmtResult};
use std::str::FromStr;
use error;
use error::{Error, ErrorKind};
use proto::Command;