Browse Source

Fix code syle nits

 - phy: Fix unused mut ref
 - wire: Fix comment collapse unneeded impl block

Closes: #250
Approved by: whitequark
Dan Robertson 6 years ago
parent
commit
8d2a20362e
3 changed files with 4 additions and 5 deletions
  1. 1 1
      src/phy/raw_socket.rs
  2. 1 1
      src/phy/tap_interface.rs
  3. 2 3
      src/wire/ipv6option.rs

+ 1 - 1
src/phy/raw_socket.rs

@@ -95,7 +95,7 @@ impl phy::TxToken for TxToken {
         let mut lower = self.lower.borrow_mut();
         let mut buffer = vec![0; len];
         let result = f(&mut buffer);
-        lower.send(&mut buffer[..]).unwrap();
+        lower.send(&buffer[..]).unwrap();
         result
     }
 }

+ 1 - 1
src/phy/tap_interface.rs

@@ -98,7 +98,7 @@ impl phy::TxToken for TxToken {
         let mut lower = self.lower.borrow_mut();
         let mut buffer = vec![0; len];
         let result = f(&mut buffer);
-        lower.send(&mut buffer[..]).unwrap();
+        lower.send(&buffer[..]).unwrap();
         result
     }
 }

+ 2 - 3
src/wire/ipv6option.rs

@@ -307,9 +307,7 @@ impl<'a> Ipv6OptionsIterator<'a> {
             length, data
         }
     }
-}
 
-impl<'a> Ipv6OptionsIterator<'a> {
     /// Helper function to return an error in the implementation
     /// of `Iterator`.
     #[inline]
@@ -343,7 +341,8 @@ impl<'a> Iterator for Ipv6OptionsIterator<'a> {
                 }
             }
         } else {
-            // If we failed to parse an option we do
+            // If we failed to parse a previous option or hit the end of the
+            // buffer, we do not continue to iterate.
             None
         }
     }