1
Fork 0

reduce references on match patterns (clippy::match_ref_pats)

This commit is contained in:
Matthias Krüger 2020-03-07 10:57:02 +01:00
parent 3f87f8cfee
commit 8351138370
3 changed files with 9 additions and 9 deletions

View file

@ -47,7 +47,7 @@ impl CommandEnv {
}
}
for (key, maybe_val) in self.vars.iter() {
if let &Some(ref val) = maybe_val {
if let Some(ref val) = maybe_val {
env::set_var(key, val);
} else {
env::remove_var(key);

View file

@ -603,8 +603,8 @@ impl Wtf8 {
if len < 3 {
return None;
}
match &self.bytes[(len - 3)..] {
&[0xED, b2 @ 0xA0..=0xAF, b3] => Some(decode_surrogate(b2, b3)),
match self.bytes[(len - 3)..] {
[0xED, b2 @ 0xA0..=0xAF, b3] => Some(decode_surrogate(b2, b3)),
_ => None,
}
}
@ -615,8 +615,8 @@ impl Wtf8 {
if len < 3 {
return None;
}
match &self.bytes[..3] {
&[0xED, b2 @ 0xB0..=0xBF, b3] => Some(decode_surrogate(b2, b3)),
match self.bytes[..3] {
[0xED, b2 @ 0xB0..=0xBF, b3] => Some(decode_surrogate(b2, b3)),
_ => None,
}
}

View file

@ -59,10 +59,10 @@ impl TestName {
}
pub fn with_padding(&self, padding: NamePadding) -> TestName {
let name = match self {
&TestName::StaticTestName(name) => Cow::Borrowed(name),
&TestName::DynTestName(ref name) => Cow::Owned(name.clone()),
&TestName::AlignedTestName(ref name, _) => name.clone(),
let name = match *self {
TestName::StaticTestName(name) => Cow::Borrowed(name),
TestName::DynTestName(ref name) => Cow::Owned(name.clone()),
TestName::AlignedTestName(ref name, _) => name.clone(),
};
TestName::AlignedTestName(name, padding)