diff --git a/src/data/command.rs b/src/data/command.rs index 0d25176..0835a00 100644 --- a/src/data/command.rs +++ b/src/data/command.rs @@ -9,7 +9,7 @@ use data::message::{Message, ToMessage}; /// [capabilities extension](https://tools.ietf.org/html/draft-mitchell-irc-capabilities-01). /// Additionally, this includes some common additional commands from popular IRCds. #[stable] -#[deriving(Show, PartialEq)] +#[derive(Show, PartialEq)] pub enum Command<'a> { // 3.1 Connection Registration /// PASS password @@ -951,7 +951,7 @@ impl<'a> Command<'a> { /// A list of all of the subcommands for the capabilities extension. #[stable] -#[deriving(Copy, Show, PartialEq)] +#[derive(Copy, Show, PartialEq)] pub enum CapSubCommand { /// Requests a list of the server's capabilities. LS, diff --git a/src/data/config.rs b/src/data/config.rs index c2c6496..e6447a6 100644 --- a/src/data/config.rs +++ b/src/data/config.rs @@ -7,7 +7,7 @@ use std::io::{InvalidInput, IoError, IoResult}; use rustc_serialize::json::decode; /// Configuration data. -#[deriving(Clone, RustcDecodable, Default, PartialEq, Show)] +#[derive(Clone, RustcDecodable, Default, PartialEq, Show)] #[unstable] pub struct Config { /// A list of the owners of the bot by nickname. diff --git a/src/data/message.rs b/src/data/message.rs index ab2d83f..995920c 100644 --- a/src/data/message.rs +++ b/src/data/message.rs @@ -5,7 +5,7 @@ use std::str::FromStr; /// IRC Message data. #[experimental] -#[deriving(Clone, PartialEq, Show)] +#[derive(Clone, PartialEq, Show)] pub struct Message { /// The message prefix (or source) as defined by [RFC 2812](http://tools.ietf.org/html/rfc2812). pub prefix: Option, diff --git a/src/data/response.rs b/src/data/response.rs index 1899441..39d21ff 100644 --- a/src/data/response.rs +++ b/src/data/response.rs @@ -1,12 +1,13 @@ //! Enumeration of all the possible server responses. #![unstable] #![allow(non_camel_case_types)] +use std::num::FromPrimitive; use std::str::FromStr; use data::message::Message; /// List of all server responses as defined in [RFC 2812](http://tools.ietf.org/html/rfc2812). /// All commands are documented with their expected form from the RFC. -#[deriving(Copy, Show, PartialEq, FromPrimitive)] +#[derive(Copy, Show, PartialEq, FromPrimitive)] #[repr(uint)] #[unstable] pub enum Response { diff --git a/src/data/user.rs b/src/data/user.rs index 252bc66..cb46974 100644 --- a/src/data/user.rs +++ b/src/data/user.rs @@ -1,11 +1,13 @@ //! Data for tracking user information. #![unstable] use std::borrow::ToOwned; +use std::cmp::Ordering; +use std::cmp::Ordering::{Less, Equal, Greater}; use std::str::FromStr; /// IRC User data. #[unstable] -#[deriving(Clone, Show)] +#[derive(Clone, Show)] pub struct User { /// The user's nickname. /// This is the only detail used in determining the equality of two users. @@ -108,7 +110,7 @@ impl PartialEq for User { /// The user's access level. #[stable] -#[deriving(Copy, PartialEq, Clone, Show)] +#[derive(Copy, PartialEq, Clone, Show)] pub enum AccessLevel { /// The channel owner (~). Owner, diff --git a/src/lib.rs b/src/lib.rs index 0efc393..af5d61f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -4,7 +4,7 @@ #![unstable] #![warn(missing_docs)] -#![feature(slicing_syntax)] +#![feature(slicing_syntax, old_orphan_check)] #[cfg(feature = "ctcp")] extern crate time; #[cfg(feature = "encode")] extern crate encoding; extern crate "rustc-serialize" as rustc_serialize; diff --git a/src/server/mod.rs b/src/server/mod.rs index ce941d6..2134c11 100644 --- a/src/server/mod.rs +++ b/src/server/mod.rs @@ -138,11 +138,11 @@ impl IrcServer { resp == Response::ERR_ERRONEOUSNICKNAME { let alt_nicks = self.config.get_alternate_nicknames(); let mut index = self.alt_nick_index.write().unwrap(); - if *index.deref() >= alt_nicks.len() { + if *index >= alt_nicks.len() { panic!("All specified nicknames were in use.") } else { - self.send(NICK(alt_nicks[*index.deref()])).unwrap(); - *index.deref_mut() += 1; + self.send(NICK(alt_nicks[*index])).unwrap(); + *index += 1; } } return