Skip to content

Commit

Permalink
clippy: address match_ref_pats warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
mathstuf committed Sep 24, 2015
1 parent 67082be commit 99efa93
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/demarshal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,8 +190,8 @@ fn demarshal_array(buf: &mut Vec<u8>, offset: &mut usize, sig: &mut String) -> R
_ => panic!("Dictionaries should contain structs")
};
let val = s.objects.remove(1);
let key = match &s.objects[0] {
&Value::BasicValue(ref x) => x,
let key = match s.objects[0] {
Value::BasicValue(ref x) => x,
_ => panic!("Dictionaries require BasicValue keys")
};
map.insert(key.clone(), val);
Expand Down
38 changes: 19 additions & 19 deletions src/marshal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -299,18 +299,18 @@ impl Marshal for Variant {

impl Marshal for BasicValue {
fn dbus_encode(&self, buf: &mut Vec<u8>) -> usize {
match self {
&BasicValue::Byte(ref x) => x.dbus_encode(buf),
&BasicValue::Boolean(ref x) => x.dbus_encode(buf),
&BasicValue::Int16(ref x) => x.dbus_encode(buf),
&BasicValue::Uint16(ref x) => x.dbus_encode(buf),
&BasicValue::Int32(ref x) => x.dbus_encode(buf),
&BasicValue::Uint32(ref x) => x.dbus_encode(buf),
&BasicValue::Int64(ref x) => x.dbus_encode(buf),
&BasicValue::Uint64(ref x) => x.dbus_encode(buf),
&BasicValue::String(ref x) => x.dbus_encode(buf),
&BasicValue::ObjectPath(ref x) => x.dbus_encode(buf),
&BasicValue::Signature(ref x) => x.dbus_encode(buf),
match *self {
BasicValue::Byte(ref x) => x.dbus_encode(buf),
BasicValue::Boolean(ref x) => x.dbus_encode(buf),
BasicValue::Int16(ref x) => x.dbus_encode(buf),
BasicValue::Uint16(ref x) => x.dbus_encode(buf),
BasicValue::Int32(ref x) => x.dbus_encode(buf),
BasicValue::Uint32(ref x) => x.dbus_encode(buf),
BasicValue::Int64(ref x) => x.dbus_encode(buf),
BasicValue::Uint64(ref x) => x.dbus_encode(buf),
BasicValue::String(ref x) => x.dbus_encode(buf),
BasicValue::ObjectPath(ref x) => x.dbus_encode(buf),
BasicValue::Signature(ref x) => x.dbus_encode(buf),
}
}

Expand All @@ -323,13 +323,13 @@ impl BasicMarshal for BasicValue { }

impl Marshal for Value {
fn dbus_encode(&self, buf: &mut Vec<u8>) -> usize {
match self {
&Value::BasicValue(ref x) => x.dbus_encode(buf),
&Value::Double(ref x) => x.dbus_encode(buf),
&Value::Array(ref x) => x.objects.dbus_encode(buf),
&Value::Variant(ref x) => x.dbus_encode(buf),
&Value::Struct(ref x) => x.dbus_encode(buf),
&Value::Dictionary(ref x) => x.map.dbus_encode(buf)
match *self {
Value::BasicValue(ref x) => x.dbus_encode(buf),
Value::Double(ref x) => x.dbus_encode(buf),
Value::Array(ref x) => x.objects.dbus_encode(buf),
Value::Variant(ref x) => x.dbus_encode(buf),
Value::Struct(ref x) => x.dbus_encode(buf),
Value::Dictionary(ref x) => x.map.dbus_encode(buf)
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ impl Message {
{
let b : &mut Box<Value> = &mut self.get_header(HEADER_FIELD_SIGNATURE).unwrap().object;
let val : &mut Value = b.deref_mut();
match val {
&mut Value::BasicValue(BasicValue::Signature(ref mut s)) => s.0.push_str(&arg.get_type()),
match *val {
Value::BasicValue(BasicValue::Signature(ref mut s)) => s.0.push_str(&arg.get_type()),
_ => panic!("Garbage in signature field")
};
}
Expand Down

0 comments on commit 99efa93

Please sign in to comment.