Run cargo fix --edition-idioms

This commit is contained in:
Linus Färnstrand
2019-03-25 15:15:41 +01:00
parent d8f3cc1992
commit 61eeb5843f
6 changed files with 9 additions and 9 deletions

View File

@ -1,6 +1,6 @@
#[macro_use] #[macro_use]
extern crate criterion; extern crate criterion;
extern crate ipnetwork;
use ipnetwork::{Ipv4Network, Ipv6Network}; use ipnetwork::{Ipv4Network, Ipv6Network};
use criterion::Criterion; use criterion::Criterion;

View File

@ -10,7 +10,7 @@ pub enum IpNetworkError {
} }
impl fmt::Display for IpNetworkError { impl fmt::Display for IpNetworkError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use crate::IpNetworkError::*; use crate::IpNetworkError::*;
match *self { match *self {
InvalidAddr(ref s) => write!(f, "invalid address: {}", s), InvalidAddr(ref s) => write!(f, "invalid address: {}", s),

View File

@ -204,7 +204,7 @@ impl Ipv4Network {
} }
impl fmt::Display for Ipv4Network { impl fmt::Display for Ipv4Network {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "{}/{}", self.ip(), self.prefix()) write!(fmt, "{}/{}", self.ip(), self.prefix())
} }
} }

View File

@ -243,7 +243,7 @@ impl Iterator for Ipv6NetworkIterator {
} }
impl fmt::Display for Ipv6Network { impl fmt::Display for Ipv6Network {
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(fmt, "{}/{}", self.ip(), self.prefix()) write!(fmt, "{}/{}", self.ip(), self.prefix())
} }
} }

View File

@ -6,7 +6,7 @@
#![crate_type = "lib"] #![crate_type = "lib"]
#![doc(html_root_url = "https://docs.rs/ipnetwork/0.14.0")] #![doc(html_root_url = "https://docs.rs/ipnetwork/0.14.0")]
extern crate serde;
use std::fmt; use std::fmt;
use std::net::IpAddr; use std::net::IpAddr;
@ -296,7 +296,7 @@ impl From<IpAddr> for IpNetwork {
} }
impl fmt::Display for IpNetwork { impl fmt::Display for IpNetwork {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match *self { match *self {
IpNetwork::V4(net) => net.fmt(f), IpNetwork::V4(net) => net.fmt(f),
IpNetwork::V6(net) => net.fmt(f), IpNetwork::V6(net) => net.fmt(f),

View File

@ -1,11 +1,11 @@
extern crate serde;
extern crate serde_json;
#[macro_use] #[macro_use]
extern crate serde_derive; extern crate serde_derive;
extern crate ipnetwork;
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {