From 15fa0936180f1779a460d41f9b4939724561e190 Mon Sep 17 00:00:00 2001 From: sharks Date: Sun, 15 Apr 2018 21:15:30 -0500 Subject: [PATCH] cargo fmt --- src/common.rs | 4 ++-- src/ipv4.rs | 6 +++--- src/ipv6.rs | 2 +- src/lib.rs | 6 +++--- tests/test_json.rs | 13 +++++++++---- 5 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/common.rs b/src/common.rs index 17ac193..5007599 100644 --- a/src/common.rs +++ b/src/common.rs @@ -1,6 +1,6 @@ -use std::net::Ipv4Addr; -use std::fmt; use std::error::Error; +use std::fmt; +use std::net::Ipv4Addr; /// Represents a bunch of errors that can occur while working with a `IpNetwork` #[derive(Debug, Clone, PartialEq, Eq)] diff --git a/src/ipv4.rs b/src/ipv4.rs index e0fd721..1ad4e1c 100644 --- a/src/ipv4.rs +++ b/src/ipv4.rs @@ -243,10 +243,10 @@ pub fn ipv4_mask_to_prefix(mask: Ipv4Addr) -> Result { #[cfg(test)] mod test { - use std::mem; - use std::collections::HashMap; - use std::net::Ipv4Addr; use super::*; + use std::collections::HashMap; + use std::mem; + use std::net::Ipv4Addr; #[test] fn create_v4() { diff --git a/src/ipv6.rs b/src/ipv6.rs index 711423e..edd53a0 100644 --- a/src/ipv6.rs +++ b/src/ipv6.rs @@ -253,8 +253,8 @@ pub fn ipv6_mask_to_prefix(mask: Ipv6Addr) -> Result { #[cfg(test)] mod test { - use std::net::Ipv6Addr; use super::*; + use std::net::Ipv6Addr; #[test] fn create_v6() { diff --git a/src/lib.rs b/src/lib.rs index cde4d7b..3722773 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -17,15 +17,15 @@ extern crate serde_derive; use std::fmt; use std::net::IpAddr; +mod common; mod ipv4; mod ipv6; -mod common; use std::str::FromStr; -pub use ipv4::{Ipv4Network, ipv4_mask_to_prefix}; -pub use ipv6::{Ipv6Network, ipv6_mask_to_prefix}; pub use common::IpNetworkError; +pub use ipv4::{ipv4_mask_to_prefix, Ipv4Network}; +pub use ipv6::{ipv6_mask_to_prefix, Ipv6Network}; /// Represents a generic network range. This type can have two variants: /// the v4 and the v6 case. diff --git a/tests/test_json.rs b/tests/test_json.rs index a71bbb1..5876cad 100644 --- a/tests/test_json.rs +++ b/tests/test_json.rs @@ -8,7 +8,6 @@ extern crate serde_derive; extern crate ipnetwork; - #[cfg(test)] mod tests { @@ -45,7 +44,10 @@ mod tests { let mystruct: MyStruct = ::serde_json::from_str(json_string).unwrap(); - assert_eq!(mystruct.ipnetwork.ip(), Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)); + assert_eq!( + mystruct.ipnetwork.ip(), + Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1) + ); assert_eq!(mystruct.ipnetwork.prefix(), 0); assert_eq!(::serde_json::to_string(&mystruct).unwrap(), json_string); @@ -65,9 +67,12 @@ mod tests { assert_eq!(mystruct.ipnetwork[0].ip(), Ipv4Addr::new(127, 1, 0, 0)); assert_eq!(mystruct.ipnetwork[0].prefix(), 24); - assert_eq!(mystruct.ipnetwork[1].ip(), Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1)); + assert_eq!( + mystruct.ipnetwork[1].ip(), + Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1) + ); assert_eq!(mystruct.ipnetwork[1].prefix(), 0); assert_eq!(::serde_json::to_string(&mystruct).unwrap(), json_string); } -} \ No newline at end of file +}