Skip to content

Commit 47effe2

Browse files
committed
Use match ergonomics
1 parent 1fc695d commit 47effe2

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/config.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -313,12 +313,12 @@ impl fmt::Display for Config {
313313
}
314314

315315
if self.last_search != LastSearch::Domain {
316-
if let Some(ref domain) = self.domain {
316+
if let Some(domain) = &self.domain {
317317
writeln!(fmt, "domain {domain}")?;
318318
}
319319
}
320320

321-
if let Some(ref search) = self.search {
321+
if let Some(search) = &self.search {
322322
if !search.is_empty() {
323323
write!(fmt, "search")?;
324324
for suffix in search.iter() {
@@ -329,7 +329,7 @@ impl fmt::Display for Config {
329329
}
330330

331331
if self.last_search == LastSearch::Domain {
332-
if let Some(ref domain) = self.domain {
332+
if let Some(domain) = &self.domain {
333333
writeln!(fmt, "domain {domain}")?;
334334
}
335335
}
@@ -418,9 +418,9 @@ impl<'a> Iterator for DomainIterInternal<'a> {
418418
type Item = &'a String;
419419

420420
fn next(&mut self) -> Option<Self::Item> {
421-
match *self {
422-
DomainIterInternal::Search(Some(ref mut domains)) => domains.next(),
423-
DomainIterInternal::Domain(ref mut domain) => domain.take(),
421+
match self {
422+
DomainIterInternal::Search(Some(domains)) => domains.next(),
423+
DomainIterInternal::Domain(domain) => domain.take(),
424424
_ => None,
425425
}
426426
}

src/ip.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ impl From<ScopedIp> for IpAddr {
4242

4343
impl From<&ScopedIp> for IpAddr {
4444
fn from(val: &ScopedIp) -> Self {
45-
match *val {
46-
ScopedIp::V4(ref ip) => IpAddr::from(*ip),
47-
ScopedIp::V6(ref ip, _) => IpAddr::from(*ip),
45+
match val {
46+
ScopedIp::V4(ip) => IpAddr::from(*ip),
47+
ScopedIp::V6(ip, _) => IpAddr::from(*ip),
4848
}
4949
}
5050
}
@@ -107,10 +107,10 @@ impl FromStr for ScopedIp {
107107

108108
impl fmt::Display for ScopedIp {
109109
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
110-
match *self {
111-
ScopedIp::V4(ref address) => address.fmt(fmt),
112-
ScopedIp::V6(ref address, None) => address.fmt(fmt),
113-
ScopedIp::V6(ref address, Some(ref scope)) => write!(fmt, "{address}%{scope}"),
110+
match self {
111+
ScopedIp::V4(address) => address.fmt(fmt),
112+
ScopedIp::V6(address, None) => address.fmt(fmt),
113+
ScopedIp::V6(address, Some(scope)) => write!(fmt, "{address}%{scope}"),
114114
}
115115
}
116116
}

0 commit comments

Comments
 (0)