Эх сурвалжийг харах

Prefer assignment operators

These were flagged by `cargo clippy`:

    warning: manual implementation of an assign operation
Alex Crawford 4 жил өмнө
parent
commit
57029d6e5d

+ 1 - 1
src/storage/assembler.rs

@@ -275,7 +275,7 @@ impl<'a> Iterator for AssemblerIter<'a> {
         let mut data_range = None;
         let mut data_range = None;
         while data_range.is_none() && self.index < self.assembler.contigs.len() {
         while data_range.is_none() && self.index < self.assembler.contigs.len() {
             let contig = self.assembler.contigs[self.index];
             let contig = self.assembler.contigs[self.index];
-            self.left = self.left + contig.hole_size;
+            self.left += contig.hole_size;
             self.right = self.left + contig.data_size;
             self.right = self.left + contig.data_size;
             data_range = if self.left < self.right {
             data_range = if self.left < self.right {
                 let data_range = (self.left + self.offset, self.right + self.offset);
                 let data_range = (self.left + self.offset, self.right + self.offset);

+ 1 - 1
src/wire/icmpv6.rs

@@ -420,7 +420,7 @@ impl<T: AsRef<[u8]> + AsMut<[u8]>> Packet<T> {
             Message::MldQuery => {
             Message::MldQuery => {
                 let data = self.buffer.as_mut();
                 let data = self.buffer.as_mut();
                 NetworkEndian::write_u16(&mut data[field::QUERY_RESV], 0);
                 NetworkEndian::write_u16(&mut data[field::QUERY_RESV], 0);
-                data[field::SQRV] = data[field::SQRV] & 0xf;
+                data[field::SQRV] &= 0xf;
             },
             },
             Message::MldReport => {
             Message::MldReport => {
                 let data = self.buffer.as_mut();
                 let data = self.buffer.as_mut();

+ 1 - 1
src/wire/ipv6fragment.rs

@@ -115,7 +115,7 @@ impl<T: AsRef<[u8]> + AsMut<[u8]>> Header<T> {
         data[field::RESERVED] = 0;
         data[field::RESERVED] = 0;
 
 
         // Retain the higher order 5 bits and lower order 1 bit
         // Retain the higher order 5 bits and lower order 1 bit
-        data[3] = data[3] & 0xf9;
+        data[3] &= 0xf9;
     }
     }
 
 
     /// Set the fragment offset field.
     /// Set the fragment offset field.

+ 1 - 1
src/wire/ipv6routing.rs

@@ -310,7 +310,7 @@ impl<T: AsRef<[u8]> + AsMut<[u8]>> Header<T> {
             }
             }
             Type::Rpl => {
             Type::Rpl => {
                 // Retain the higher order 4 bits of the padding field
                 // Retain the higher order 4 bits of the padding field
-                data[field::PAD] = data[field::PAD] & 0xF0;
+                data[field::PAD] &= 0xF0;
                 data[6] = 0;
                 data[6] = 0;
                 data[7] = 0;
                 data[7] = 0;
             }
             }

+ 1 - 1
src/wire/mld.rs

@@ -125,7 +125,7 @@ impl<T: AsRef<[u8]> + AsMut<[u8]>> Packet<T> {
     #[inline]
     #[inline]
     pub fn clear_s_flag(&mut self) {
     pub fn clear_s_flag(&mut self) {
         let data = self.buffer.as_mut();
         let data = self.buffer.as_mut();
-        data[field::SQRV] = data[field::SQRV] & 0x7;
+        data[field::SQRV] &= 0x7;
     }
     }
 
 
     /// Set the Querier's Robustness Variable.
     /// Set the Querier's Robustness Variable.