Fix most warnings

Blocked on rust-lang/rust#23734 on the last
This commit is contained in:
Steven Fackler 2015-03-26 09:18:49 -07:00
parent 44d47335d3
commit 7bcb8fb358
3 changed files with 20 additions and 21 deletions

View File

@ -65,9 +65,9 @@ impl error::Error for ConnectError {
fn cause(&self) -> Option<&error::Error> { fn cause(&self) -> Option<&error::Error> {
match *self { match *self {
ConnectError::DbError(ref err) => Some(err as &error::Error), ConnectError::DbError(ref err) => Some(err),
ConnectError::SslError(ref err) => Some(err as &error::Error), ConnectError::SslError(ref err) => Some(err),
ConnectError::IoError(ref err) => Some(err as &error::Error), ConnectError::IoError(ref err) => Some(err),
_ => None _ => None
} }
} }
@ -159,8 +159,8 @@ impl error::Error for Error {
fn cause(&self) -> Option<&error::Error> { fn cause(&self) -> Option<&error::Error> {
match *self { match *self {
Error::DbError(ref err) => Some(err as &error::Error), Error::DbError(ref err) => Some(err),
Error::IoError(ref err) => Some(err as &error::Error), Error::IoError(ref err) => Some(err),
_ => None _ => None
} }
} }

View File

@ -120,7 +120,7 @@ fn decode_inner(c: &str, full_url: bool) -> DecodeResult<String> {
Some(b) => match b as char { Some(b) => match b as char {
'%' => { '%' => {
let bytes = match (iter.next(), iter.next()) { let bytes = match (iter.next(), iter.next()) {
(Some(one), Some(two)) => [one as u8, two as u8], (Some(one), Some(two)) => [one, two],
_ => return Err(format!("Malformed input: found '%' \ _ => return Err(format!("Malformed input: found '%' \
without two trailing bytes")), without two trailing bytes")),
}; };

View File

@ -17,7 +17,6 @@ use postgres::{HandleNotice,
SslMode, SslMode,
Type, Type,
Kind, Kind,
ToSql,
Error, Error,
ConnectError, ConnectError,
DbError, DbError,
@ -761,8 +760,8 @@ fn test_copy_in() {
let stmt = or_panic!(conn.prepare_copy_in("foo", &["id", "name"])); let stmt = or_panic!(conn.prepare_copy_in("foo", &["id", "name"]));
let data = (0i32..2).map(|i| { let data = (0i32..2).map(|i| {
VecStreamIterator::new(vec![Box::new(i) as Box<ToSql>, VecStreamIterator::new(vec![Box::new(i),
Box::new(format!("{}", i)) as Box<ToSql>]) Box::new(format!("{}", i))])
}); });
assert_eq!(Ok(2), stmt.execute(data)); assert_eq!(Ok(2), stmt.execute(data));
@ -779,9 +778,9 @@ fn test_copy_in_bad_column_count() {
let stmt = or_panic!(conn.prepare_copy_in("foo", &["id", "name"])); let stmt = or_panic!(conn.prepare_copy_in("foo", &["id", "name"]));
let data = vec![ let data = vec![
VecStreamIterator::new(vec![Box::new(1i32) as Box<ToSql>, VecStreamIterator::new(vec![Box::new(1i32),
Box::new("Steven".to_string()) as Box<ToSql>]), Box::new("Steven".to_string())]),
VecStreamIterator::new(vec![Box::new(2i32) as Box<ToSql>]), VecStreamIterator::new(vec![Box::new(2i32)]),
].into_iter(); ].into_iter();
let res = stmt.execute(data); let res = stmt.execute(data);
@ -792,11 +791,11 @@ fn test_copy_in_bad_column_count() {
} }
let data = vec![ let data = vec![
VecStreamIterator::new(vec![Box::new(1i32) as Box<ToSql>, VecStreamIterator::new(vec![Box::new(1i32),
Box::new("Steven".to_string()) as Box<ToSql>]), Box::new("Steven".to_string())]),
VecStreamIterator::new(vec![Box::new(2i32) as Box<ToSql>, VecStreamIterator::new(vec![Box::new(2i32),
Box::new("Steven".to_string()) as Box<ToSql>, Box::new("Steven".to_string()),
Box::new(3i64) as Box<ToSql>]), Box::new(3i64)]),
].into_iter(); ].into_iter();
let res = stmt.execute(data); let res = stmt.execute(data);
@ -817,10 +816,10 @@ fn test_copy_in_bad_type() {
let stmt = or_panic!(conn.prepare_copy_in("foo", &["id", "name"])); let stmt = or_panic!(conn.prepare_copy_in("foo", &["id", "name"]));
let data = vec![ let data = vec![
VecStreamIterator::new(vec![Box::new(1i32) as Box<ToSql>, VecStreamIterator::new(vec![Box::new(1i32),
Box::new("Steven".to_string()) as Box<ToSql>]), Box::new("Steven".to_string())]),
VecStreamIterator::new(vec![Box::new(2i32) as Box<ToSql>, VecStreamIterator::new(vec![Box::new(2i32),
Box::new(1i32) as Box<ToSql>]), Box::new(1i32)]),
].into_iter(); ].into_iter();
let res = stmt.execute(data); let res = stmt.execute(data);