Skip to content

Commit 0342811

Browse files
committed
enable rust_2018_idioms warning and fix elided-lifetimes-in-paths
1 parent acea816 commit 0342811

File tree

10 files changed

+19
-18
lines changed

10 files changed

+19
-18
lines changed

src/cidr/any.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ impl AnyIpCidr {
211211
}
212212

213213
impl fmt::Display for AnyIpCidr {
214-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
214+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
215215
match self {
216216
Self::Any => write!(f, "any"),
217217
Self::V4(c) => fmt::Display::fmt(c, f),

src/cidr/combined.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ impl Cidr for IpCidr {
215215
}
216216

217217
impl fmt::Display for IpCidr {
218-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
218+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
219219
match self {
220220
Self::V4(c) => fmt::Display::fmt(c, f),
221221
Self::V6(c) => fmt::Display::fmt(c, f),

src/cidr/direct.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -240,13 +240,13 @@ macro_rules! impl_cidr_for {
240240
}
241241

242242
impl fmt::Debug for $n {
243-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
243+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
244244
write!(f, "{:?}/{}", self.address, self.network_length)
245245
}
246246
}
247247

248248
impl fmt::Display for $n {
249-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
249+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
250250
if f.alternate() || !self.is_host_address() {
251251
write!(f, "{}/{}", self.address, self.network_length)?;
252252
} else {

src/errors.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ impl NetworkLengthTooLongError {
2222
}
2323

2424
impl fmt::Debug for NetworkLengthTooLongError {
25-
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
25+
fn fmt(&self, w: &mut fmt::Formatter<'_>) -> fmt::Result {
2626
write!(
2727
w,
2828
"Network length {} is too long for {:?} (maximum: {})",
@@ -33,7 +33,7 @@ impl fmt::Debug for NetworkLengthTooLongError {
3333
}
3434
}
3535
impl fmt::Display for NetworkLengthTooLongError {
36-
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
36+
fn fmt(&self, w: &mut fmt::Formatter<'_>) -> fmt::Result {
3737
fmt::Debug::fmt(self, w)
3838
}
3939
}
@@ -64,7 +64,7 @@ pub enum NetworkParseError {
6464
NetworkLengthTooLongError(NetworkLengthTooLongError),
6565
}
6666
impl fmt::Debug for NetworkParseError {
67-
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
67+
fn fmt(&self, w: &mut fmt::Formatter<'_>) -> fmt::Result {
6868
match self {
6969
Self::InvalidHostPart => write!(w, "host part of address was not zero"),
7070
Self::AddrParseError(e) => {
@@ -80,7 +80,7 @@ impl fmt::Debug for NetworkParseError {
8080
}
8181
}
8282
impl fmt::Display for NetworkParseError {
83-
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
83+
fn fmt(&self, w: &mut fmt::Formatter<'_>) -> fmt::Result {
8484
fmt::Debug::fmt(self, w)
8585
}
8686
}
@@ -132,7 +132,7 @@ pub enum InetTupleError {
132132
}
133133

134134
impl fmt::Debug for InetTupleError {
135-
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
135+
fn fmt(&self, w: &mut fmt::Formatter<'_>) -> fmt::Result {
136136
match self {
137137
Self::NotInSharedNetwork => write!(w, "addresses not in shared network"),
138138
Self::NetworkLengthTooLongError(e) => {
@@ -143,7 +143,7 @@ impl fmt::Debug for InetTupleError {
143143
}
144144

145145
impl fmt::Display for InetTupleError {
146-
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
146+
fn fmt(&self, w: &mut fmt::Formatter<'_>) -> fmt::Result {
147147
fmt::Debug::fmt(self, w)
148148
}
149149
}

src/inet/combined.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ impl Inet for IpInet {
249249
}
250250

251251
impl fmt::Display for IpInet {
252-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
252+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
253253
match self {
254254
Self::V4(c) => fmt::Display::fmt(c, f),
255255
Self::V6(c) => fmt::Display::fmt(c, f),

src/inet/direct.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,13 @@ macro_rules! impl_inet_for {
272272
}
273273

274274
impl fmt::Debug for $n {
275-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
275+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
276276
write!(f, "{:?}/{}", self.address, self.network_length)
277277
}
278278
}
279279

280280
impl fmt::Display for $n {
281-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
281+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
282282
if f.alternate() || !self.is_host_address() {
283283
write!(f, "{}/{}", self.address, self.network_length)?;
284284
} else {

src/inet_pair/combined.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ impl InetPair for IpInetPair {
216216
}
217217

218218
impl fmt::Display for IpInetPair {
219-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
219+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
220220
match self {
221221
Self::V4(c) => fmt::Display::fmt(c, f),
222222
Self::V6(c) => fmt::Display::fmt(c, f),

src/inet_pair/direct.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ macro_rules! impl_inet_pair_for {
173173
}
174174

175175
impl fmt::Debug for $n {
176-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
176+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
177177
f.debug_struct(stringify!($n))
178178
.field("first", &self.first())
179179
.field("second", &self.second())
@@ -182,7 +182,7 @@ macro_rules! impl_inet_pair_for {
182182
}
183183

184184
impl fmt::Display for $n {
185-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
185+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
186186
use core::fmt::Write;
187187
f.write_char('(')?;
188188
self.first().fmt(f)?;

src/lib.rs

+1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#![cfg_attr(doc_cfg, feature(doc_cfg))]
22
#![cfg_attr(not(feature = "std"), no_std)]
33
#![warn(missing_docs)]
4+
#![warn(rust_2018_idioms)]
45
#![doc(html_root_url = "https://docs.rs/cidr/0.2.1")]
56
#![allow(clippy::match_like_matches_macro)]
67

src/serde_common.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ where
9090
impl<'de> de::Visitor<'de> for Visitor {
9191
type Value = Option<(IpAddr, u8)>;
9292

93-
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
93+
fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
9494
formatter.write_str("a tuple with two fields")
9595
}
9696

@@ -131,7 +131,7 @@ where
131131
impl<'de> de::Visitor<'de> for NewTypeVisitor {
132132
type Value = Option<(IpAddr, u8)>;
133133

134-
fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result {
134+
fn expecting(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
135135
formatter.write_str("newtype `")?;
136136
formatter.write_str(self.0)?;
137137
formatter.write_str("`")

0 commit comments

Comments
 (0)