Browse Source

Remove two more type conversions

In both these cases, we know the length of the buffer in a variable that's already of the same type, so just use that value instead — and that's how all the other record parsers do it, too.
Benjamin Sago 4 years ago
parent
commit
9e1befcb98
2 changed files with 2 additions and 2 deletions
  1. 1 1
      dns/src/record/a.rs
  2. 1 1
      dns/src/record/aaaa.rs

+ 1 - 1
dns/src/record/a.rs

@@ -35,7 +35,7 @@ impl Wire for A {
         }
         else {
             warn!("Length is incorrect (record length {:?}, but should be four)", len);
-            Err(WireError::WrongRecordLength { expected: 4, got: buf.len() as u16 })
+            Err(WireError::WrongRecordLength { expected: 4, got: len })
         }
     }
 }

+ 1 - 1
dns/src/record/aaaa.rs

@@ -37,7 +37,7 @@ impl Wire for AAAA {
         }
         else {
             warn!("Length is incorrect (record length {:?}, but should be sixteen)", len);
-            Err(WireError::WrongRecordLength { expected: 16, got: buf.len() as u16 })
+            Err(WireError::WrongRecordLength { expected: 16, got: len })
         }
     }
 }