@@ -809,7 +809,7 @@ impl MavType {
809
809
/// Emit reader of a given type
810
810
pub fn rust_reader ( & self , val : & TokenStream , buf : Ident ) -> TokenStream {
811
811
use self :: MavType :: * ;
812
- match self . clone ( ) {
812
+ match self {
813
813
Char => quote ! { #val = #buf. get_u8( ) ; } ,
814
814
UInt8 => quote ! { #val = #buf. get_u8( ) ; } ,
815
815
UInt16 => quote ! { #val = #buf. get_u16_le( ) ; } ,
@@ -837,7 +837,7 @@ impl MavType {
837
837
/// Emit writer of a given type
838
838
pub fn rust_writer ( & self , val : & TokenStream , buf : Ident ) -> TokenStream {
839
839
use self :: MavType :: * ;
840
- match self . clone ( ) {
840
+ match self {
841
841
UInt8MavlinkVersion => quote ! { #buf. put_u8( #val) ; } ,
842
842
UInt8 => quote ! { #buf. put_u8( #val) ; } ,
843
843
Char => quote ! { #buf. put_u8( #val) ; } ,
@@ -864,7 +864,7 @@ impl MavType {
864
864
/// Size of a given Mavtype
865
865
fn len ( & self ) -> usize {
866
866
use self :: MavType :: * ;
867
- match self . clone ( ) {
867
+ match self {
868
868
UInt8MavlinkVersion | UInt8 | Int8 | Char => 1 ,
869
869
UInt16 | Int16 => 2 ,
870
870
UInt32 | Int32 | Float => 4 ,
@@ -876,7 +876,7 @@ impl MavType {
876
876
/// Used for ordering of types
877
877
fn order_len ( & self ) -> usize {
878
878
use self :: MavType :: * ;
879
- match self . clone ( ) {
879
+ match self {
880
880
UInt8MavlinkVersion | UInt8 | Int8 | Char => 1 ,
881
881
UInt16 | Int16 => 2 ,
882
882
UInt32 | Int32 | Float => 4 ,
@@ -888,7 +888,7 @@ impl MavType {
888
888
/// Used for crc calculation
889
889
pub fn primitive_type ( & self ) -> String {
890
890
use self :: MavType :: * ;
891
- match self . clone ( ) {
891
+ match self {
892
892
UInt8MavlinkVersion => "uint8_t" . into ( ) ,
893
893
UInt8 => "uint8_t" . into ( ) ,
894
894
Int8 => "int8_t" . into ( ) ,
@@ -909,7 +909,7 @@ impl MavType {
909
909
/// Used for generating struct fields.
910
910
pub fn rust_type ( & self ) -> String {
911
911
use self :: MavType :: * ;
912
- match self . clone ( ) {
912
+ match self {
913
913
UInt8 | UInt8MavlinkVersion => "u8" . into ( ) ,
914
914
Int8 => "i8" . into ( ) ,
915
915
Char => "u8" . into ( ) ,
@@ -927,7 +927,6 @@ impl MavType {
927
927
928
928
pub fn emit_default_value ( & self ) -> TokenStream {
929
929
use self :: MavType :: * ;
930
-
931
930
match self {
932
931
UInt8 | UInt8MavlinkVersion => quote ! ( 0_u8 ) ,
933
932
Int8 => quote ! ( 0_i8 ) ,
0 commit comments