Browse Source

Fix clippy.

Dario Nieuwenhuis 2 years ago
parent
commit
7bc1d4e4ea
3 changed files with 6 additions and 21 deletions
  1. 2 7
      src/iface/socket_meta.rs
  2. 2 7
      src/phy/mod.rs
  3. 2 7
      src/socket/icmp.rs

+ 2 - 7
src/iface/socket_meta.rs

@@ -9,10 +9,11 @@ use crate::{
 ///
 /// This enum tracks whether the socket should be polled based on the neighbor
 /// it is going to send packets to.
-#[derive(Debug)]
+#[derive(Debug, Default)]
 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
 enum NeighborState {
     /// Socket can be polled immediately.
+    #[default]
     Active,
     /// Socket should not be polled until either `silent_until` passes or
     /// `neighbor` appears in the neighbor cache.
@@ -22,12 +23,6 @@ enum NeighborState {
     },
 }
 
-impl Default for NeighborState {
-    fn default() -> Self {
-        NeighborState::Active
-    }
-}
-
 /// Network socket metadata.
 ///
 /// This includes things that only external (to the socket, that is) code

+ 2 - 7
src/phy/mod.rs

@@ -131,10 +131,11 @@ pub use self::tracer::Tracer;
 pub use self::tuntap_interface::TunTapInterface;
 
 /// A description of checksum behavior for a particular protocol.
-#[derive(Debug, Clone, Copy)]
+#[derive(Debug, Clone, Copy, Default)]
 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
 pub enum Checksum {
     /// Verify checksum when receiving and compute checksum when sending.
+    #[default]
     Both,
     /// Verify checksum when receiving.
     Rx,
@@ -144,12 +145,6 @@ pub enum Checksum {
     None,
 }
 
-impl Default for Checksum {
-    fn default() -> Checksum {
-        Checksum::Both
-    }
-}
-
 impl Checksum {
     /// Returns whether checksum should be verified when receiving.
     pub fn rx(&self) -> bool {

+ 2 - 7
src/socket/icmp.rs

@@ -43,9 +43,10 @@ pub enum RecvError {
 /// more details.
 ///
 /// [IcmpSocket::bind]: struct.IcmpSocket.html#method.bind
-#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
+#[derive(Debug, Default, PartialEq, Eq, PartialOrd, Ord, Clone, Copy)]
 #[cfg_attr(feature = "defmt", derive(defmt::Format))]
 pub enum Endpoint {
+    #[default]
     Unspecified,
     Ident(u16),
     Udp(IpListenEndpoint),
@@ -61,12 +62,6 @@ impl Endpoint {
     }
 }
 
-impl Default for Endpoint {
-    fn default() -> Endpoint {
-        Endpoint::Unspecified
-    }
-}
-
 /// An ICMP packet metadata.
 pub type PacketMetadata = crate::storage::PacketMetadata<IpAddress>;