Skip to content

Commit

Permalink
Fix clippy warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
pizzamig committed Apr 10, 2019
1 parent 0969de0 commit 681fcc0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/ip.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub struct HostV4Opt {
impl GetWithDefault for HostV4Opt {
type Item = Ipv4Addr;
fn get_with_default<T: Into<Self::Item>>(&self, default: T) -> Self::Item {
self.host_addr.unwrap_or(default.into())
self.host_addr.unwrap_or_else(|| default.into())
}
}

Expand Down Expand Up @@ -111,7 +111,7 @@ pub struct HostV6Opt {
impl GetWithDefault for HostV6Opt {
type Item = Ipv6Addr;
fn get_with_default<T: Into<Self::Item>>(&self, default: T) -> Self::Item {
self.host_addr.unwrap_or(default.into())
self.host_addr.unwrap_or_else(|| default.into())
}
}

Expand Down Expand Up @@ -184,7 +184,7 @@ pub struct HostOpt {
impl GetWithDefault for HostOpt {
type Item = IpAddr;
fn get_with_default<T: Into<Self::Item>>(&self, default: T) -> Self::Item {
self.host_addr.unwrap_or(default.into())
self.host_addr.unwrap_or_else(|| default.into())
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/logopt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ pub struct LogLevelNoDef {
impl GetWithDefault for LogLevelNoDef {
type Item = LevelFilter;
fn get_with_default<T: Into<Self::Item>>(&self, default: T) -> Self::Item {
self.log_level.unwrap_or(default.into())
self.log_level.unwrap_or_else(|| default.into())
}
}

Expand Down Expand Up @@ -234,7 +234,7 @@ pub struct LogLevelNoDefLower {
impl GetWithDefault for LogLevelNoDefLower {
type Item = LevelFilter;
fn get_with_default<T: Into<Self::Item>>(&self, default: T) -> Self::Item {
self.log_level.unwrap_or(default.into())
self.log_level.unwrap_or_else(|| default.into())
}
}

Expand Down

0 comments on commit 681fcc0

Please sign in to comment.