More clean-up, and warning fixes.

This commit is contained in:
Aaron Weiss 2015-02-21 10:31:46 -05:00
parent 76e7aea8e7
commit 6404bef80a
3 changed files with 15 additions and 15 deletions

View file

@ -258,7 +258,7 @@ mod test {
Message::new(None, "PRIVMSG", Some(vec!["test"]), Some("Testing!"))
).is_ok());
let data = String::from_utf8(conn.writer().get_ref().to_vec()).unwrap();
assert_eq!(&data[], "PRIVMSG test :Testing!\r\n");
assert_eq!(&data[..], "PRIVMSG test :Testing!\r\n");
}
#[test]
@ -268,7 +268,7 @@ mod test {
let conn = Connection::new(NullReader, MemWriter::new());
assert!(conn.send(exp).is_ok());
let data = String::from_utf8(conn.writer().get_ref().to_vec()).unwrap();
assert_eq!(&data[], exp);
assert_eq!(&data[..], exp);
}
#[test]
@ -279,7 +279,7 @@ mod test {
Message::new(None, "PRIVMSG", Some(vec!["test"]), Some("€ŠšŽžŒœŸ")), "UTF-8"
).is_ok());
let data = UTF_8.decode(conn.writer().get_ref(), DecoderTrap::Strict).unwrap();
assert_eq!(&data[], "PRIVMSG test :€ŠšŽžŒœŸ\r\n");
assert_eq!(&data[..], "PRIVMSG test :€ŠšŽžŒœŸ\r\n");
}
#[test]
@ -289,7 +289,7 @@ mod test {
let conn = Connection::new(NullReader, MemWriter::new());
assert!(conn.send(exp, "UTF-8").is_ok());
let data = UTF_8.decode(conn.writer().get_ref(), DecoderTrap::Strict).unwrap();
assert_eq!(&data[], exp);
assert_eq!(&data[..], exp);
}
#[test]
@ -300,7 +300,7 @@ mod test {
Message::new(None, "PRIVMSG", Some(vec!["test"]), Some("€ŠšŽžŒœŸ")), "l9"
).is_ok());
let data = ISO_8859_15.decode(conn.writer().get_ref(), DecoderTrap::Strict).unwrap();
assert_eq!(&data[], "PRIVMSG test :€ŠšŽžŒœŸ\r\n");
assert_eq!(&data[..], "PRIVMSG test :€ŠšŽžŒœŸ\r\n");
}
#[test]
@ -310,7 +310,7 @@ mod test {
let conn = Connection::new(NullReader, MemWriter::new());
assert!(conn.send(exp, "l9").is_ok());
let data = ISO_8859_15.decode(conn.writer().get_ref(), DecoderTrap::Strict).unwrap();
assert_eq!(&data[], exp);
assert_eq!(&data[..], exp);
}
#[test]
@ -319,7 +319,7 @@ mod test {
let conn = Connection::new(
MemReader::new("PRIVMSG test :Testing!\r\n".as_bytes().to_vec()), NullWriter
);
assert_eq!(&conn.recv().unwrap()[], "PRIVMSG test :Testing!\r\n");
assert_eq!(&conn.recv().unwrap()[..], "PRIVMSG test :Testing!\r\n");
}
#[test]
@ -328,7 +328,7 @@ mod test {
let conn = Connection::new(
MemReader::new(b"PRIVMSG test :Testing!\r\n".to_vec()), NullWriter
);
assert_eq!(&conn.recv("UTF-8").unwrap()[], "PRIVMSG test :Testing!\r\n");
assert_eq!(&conn.recv("UTF-8").unwrap()[..], "PRIVMSG test :Testing!\r\n");
}
#[test]
@ -343,6 +343,6 @@ mod test {
vec
}), NullWriter
);
assert_eq!(&conn.recv("l9").unwrap()[], "PRIVMSG test :€ŠšŽžŒœŸ\r\n");
assert_eq!(&conn.recv("l9").unwrap()[..], "PRIVMSG test :€ŠšŽžŒœŸ\r\n");
}
}

View file

@ -150,14 +150,14 @@ mod test {
args: vec![format!("test")],
suffix: Some(format!("Testing!")),
};
assert_eq!(&message.into_string()[], "PRIVMSG test :Testing!\r\n");
assert_eq!(&message.into_string()[..], "PRIVMSG test :Testing!\r\n");
let message = Message {
prefix: Some(format!("test!test@test")),
command: format!("PRIVMSG"),
args: vec![format!("test")],
suffix: Some(format!("Still testing!")),
};
assert_eq!(&message.into_string()[], ":test!test@test PRIVMSG test :Still testing!\r\n");
assert_eq!(&message.into_string()[..], ":test!test@test PRIVMSG test :Still testing!\r\n");
}
#[test]

View file

@ -144,14 +144,14 @@ impl<T: IrcReader, U: IrcWriter> IrcServer<T, U> {
} else if resp == Response::RPL_ENDOFMOTD || resp == Response::ERR_NOMOTD {
if self.config.nick_password() != "" {
self.send(NICKSERV(
&format!("IDENTIFY {}", self.config.nick_password())[..]
&format!("IDENTIFY {}", self.config.nick_password())
)).unwrap();
}
if self.config.umodes() != "" {
self.send(MODE(self.config.nickname(), self.config.umodes(), None)).unwrap();
}
for chan in self.config.channels().into_iter() {
self.send(JOIN(&chan[..], None)).unwrap();
self.send(JOIN(&chan, None)).unwrap();
}
} else if resp == Response::ERR_NICKNAMEINUSE ||
resp == Response::ERR_ERRONEOUSNICKNAME {
@ -190,8 +190,8 @@ impl<T: IrcReader, U: IrcWriter> IrcServer<T, U> {
} else if let ("MODE", [ref chan, ref mode, ref user]) = (&msg.command[..], &msg.args[..]) {
if cfg!(not(feature = "nochanlists")) {
if let Some(vec) = self.chanlists.lock().unwrap().get_mut(chan) {
if let Some(n) = vec.as_slice().position_elem(&User::new(&user[..])) {
vec[n].update_access_level(&mode[..]);
if let Some(n) = vec.as_slice().position_elem(&User::new(&user)) {
vec[n].update_access_level(&mode);
}
}
}