More clippy fixin's.
This commit is contained in:
@@ -97,7 +97,7 @@ impl Arbitrary for ClientConnectionCommand {
|
|||||||
ClientConnectionCommand::EstablishTCPPortBinding,
|
ClientConnectionCommand::EstablishTCPPortBinding,
|
||||||
ClientConnectionCommand::AssociateUDPPort,
|
ClientConnectionCommand::AssociateUDPPort,
|
||||||
];
|
];
|
||||||
g.choose(&options).unwrap().clone()
|
*g.choose(&options).unwrap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,8 +164,8 @@ fn short_write_fails_right() {
|
|||||||
let mut cursor = Cursor::new(&mut buffer as &mut [u8]);
|
let mut cursor = Cursor::new(&mut buffer as &mut [u8]);
|
||||||
let result = task::block_on(cmd.write(&mut cursor));
|
let result = task::block_on(cmd.write(&mut cursor));
|
||||||
match result {
|
match result {
|
||||||
Ok(_) => assert!(false, "Mysteriously able to fit > 2 bytes in 2 bytes."),
|
Ok(_) => panic!("Mysteriously able to fit > 2 bytes in 2 bytes."),
|
||||||
Err(SerializationError::IOError(x)) => assert_eq!(ErrorKind::WriteZero, x.kind()),
|
Err(SerializationError::IOError(x)) => assert_eq!(ErrorKind::WriteZero, x.kind()),
|
||||||
Err(e) => assert!(false, "Got the wrong error writing too much data: {}", e),
|
Err(e) => panic!("Got the wrong error writing too much data: {}", e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -200,8 +200,8 @@ fn short_write_fails_right() {
|
|||||||
let mut cursor = Cursor::new(&mut buffer as &mut [u8]);
|
let mut cursor = Cursor::new(&mut buffer as &mut [u8]);
|
||||||
let result = task::block_on(cmd.write(&mut cursor));
|
let result = task::block_on(cmd.write(&mut cursor));
|
||||||
match result {
|
match result {
|
||||||
Ok(_) => assert!(false, "Mysteriously able to fit > 2 bytes in 2 bytes."),
|
Ok(_) => panic!("Mysteriously able to fit > 2 bytes in 2 bytes."),
|
||||||
Err(SerializationError::IOError(x)) => assert_eq!(ErrorKind::WriteZero, x.kind()),
|
Err(SerializationError::IOError(x)) => assert_eq!(ErrorKind::WriteZero, x.kind()),
|
||||||
Err(e) => assert!(false, "Got the wrong error writing too much data: {}", e),
|
Err(e) => panic!("Got the wrong error writing too much data: {}", e),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ pub fn arbitrary_socks_string(g: &mut Gen) -> String {
|
|||||||
potential.truncate(255);
|
potential.truncate(255);
|
||||||
let bytestring = potential.as_bytes();
|
let bytestring = potential.as_bytes();
|
||||||
|
|
||||||
if bytestring.len() > 0 && bytestring.len() < 256 {
|
if !bytestring.is_empty() && bytestring.len() < 256 {
|
||||||
return potential;
|
return potential;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -195,27 +195,27 @@ quickcheck! {
|
|||||||
match x {
|
match x {
|
||||||
IpAddr::V4(ref a) =>
|
IpAddr::V4(ref a) =>
|
||||||
assert_eq!(Err(AddressConversionError::CouldntConvertIP4),
|
assert_eq!(Err(AddressConversionError::CouldntConvertIP4),
|
||||||
Ipv6Addr::try_from(SOCKSv5Address::from(a.clone()))),
|
Ipv6Addr::try_from(SOCKSv5Address::from(*a))),
|
||||||
IpAddr::V6(ref a) =>
|
IpAddr::V6(ref a) =>
|
||||||
assert_eq!(Err(AddressConversionError::CouldntConvertIP6),
|
assert_eq!(Err(AddressConversionError::CouldntConvertIP6),
|
||||||
Ipv4Addr::try_from(SOCKSv5Address::from(a.clone()))),
|
Ipv4Addr::try_from(SOCKSv5Address::from(*a))),
|
||||||
}
|
}
|
||||||
x == IpAddr::try_from(SOCKSv5Address::from(x.clone())).unwrap()
|
x == IpAddr::try_from(SOCKSv5Address::from(x)).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ip4_conversion(x: Ipv4Addr) -> bool {
|
fn ip4_conversion(x: Ipv4Addr) -> bool {
|
||||||
x == Ipv4Addr::try_from(SOCKSv5Address::from(x.clone())).unwrap()
|
x == Ipv4Addr::try_from(SOCKSv5Address::from(x)).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn ip6_conversion(x: Ipv6Addr) -> bool {
|
fn ip6_conversion(x: Ipv6Addr) -> bool {
|
||||||
x == Ipv6Addr::try_from(SOCKSv5Address::from(x.clone())).unwrap()
|
x == Ipv6Addr::try_from(SOCKSv5Address::from(x)).unwrap()
|
||||||
}
|
}
|
||||||
|
|
||||||
fn display_matches(x: SOCKSv5Address) -> bool {
|
fn display_matches(x: SOCKSv5Address) -> bool {
|
||||||
match x {
|
match x {
|
||||||
SOCKSv5Address::IP4(a) => format!("{}", a) == format!("{}", x),
|
SOCKSv5Address::IP4(a) => format!("{}", a) == format!("{}", x),
|
||||||
SOCKSv5Address::IP6(a) => format!("{}", a) == format!("{}", x),
|
SOCKSv5Address::IP6(a) => format!("{}", a) == format!("{}", x),
|
||||||
SOCKSv5Address::Name(ref a) => format!("{}", a) == format!("{}", x),
|
SOCKSv5Address::Name(ref a) => *a == x.to_string(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,6 +253,6 @@ fn domain_name_sanity() {
|
|||||||
);
|
);
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
Err(AddressConversionError::CouldntConvertName),
|
Err(AddressConversionError::CouldntConvertName),
|
||||||
Ipv6Addr::try_from(addr1.clone())
|
Ipv6Addr::try_from(addr1)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user