Skip to content

Commit 19154d8

Browse files
antonio-sc66patrickelectric
authored andcommitted
Cleanup. Remove unnecessary self.clone() calls
1 parent 9353461 commit 19154d8

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

build/parser.rs

+6-7
Original file line numberDiff line numberDiff line change
@@ -809,7 +809,7 @@ impl MavType {
809809
/// Emit reader of a given type
810810
pub fn rust_reader(&self, val: &TokenStream, buf: Ident) -> TokenStream {
811811
use self::MavType::*;
812-
match self.clone() {
812+
match self {
813813
Char => quote! {#val = #buf.get_u8();},
814814
UInt8 => quote! {#val = #buf.get_u8();},
815815
UInt16 => quote! {#val = #buf.get_u16_le();},
@@ -837,7 +837,7 @@ impl MavType {
837837
/// Emit writer of a given type
838838
pub fn rust_writer(&self, val: &TokenStream, buf: Ident) -> TokenStream {
839839
use self::MavType::*;
840-
match self.clone() {
840+
match self {
841841
UInt8MavlinkVersion => quote! {#buf.put_u8(#val);},
842842
UInt8 => quote! {#buf.put_u8(#val);},
843843
Char => quote! {#buf.put_u8(#val);},
@@ -864,7 +864,7 @@ impl MavType {
864864
/// Size of a given Mavtype
865865
fn len(&self) -> usize {
866866
use self::MavType::*;
867-
match self.clone() {
867+
match self {
868868
UInt8MavlinkVersion | UInt8 | Int8 | Char => 1,
869869
UInt16 | Int16 => 2,
870870
UInt32 | Int32 | Float => 4,
@@ -876,7 +876,7 @@ impl MavType {
876876
/// Used for ordering of types
877877
fn order_len(&self) -> usize {
878878
use self::MavType::*;
879-
match self.clone() {
879+
match self {
880880
UInt8MavlinkVersion | UInt8 | Int8 | Char => 1,
881881
UInt16 | Int16 => 2,
882882
UInt32 | Int32 | Float => 4,
@@ -888,7 +888,7 @@ impl MavType {
888888
/// Used for crc calculation
889889
pub fn primitive_type(&self) -> String {
890890
use self::MavType::*;
891-
match self.clone() {
891+
match self {
892892
UInt8MavlinkVersion => "uint8_t".into(),
893893
UInt8 => "uint8_t".into(),
894894
Int8 => "int8_t".into(),
@@ -909,7 +909,7 @@ impl MavType {
909909
/// Used for generating struct fields.
910910
pub fn rust_type(&self) -> String {
911911
use self::MavType::*;
912-
match self.clone() {
912+
match self {
913913
UInt8 | UInt8MavlinkVersion => "u8".into(),
914914
Int8 => "i8".into(),
915915
Char => "u8".into(),
@@ -927,7 +927,6 @@ impl MavType {
927927

928928
pub fn emit_default_value(&self) -> TokenStream {
929929
use self::MavType::*;
930-
931930
match self {
932931
UInt8 | UInt8MavlinkVersion => quote!(0_u8),
933932
Int8 => quote!(0_i8),

0 commit comments

Comments
 (0)