chore: Appease clippy

This commit is contained in:
relrelb 2022-03-16 00:30:27 +02:00 committed by relrelb
parent 5da7149aaf
commit 1db29217eb
2 changed files with 4 additions and 12 deletions

View File

@ -131,12 +131,8 @@ fn get_progress<'gc>(
// TODO: What happens with negative levels? // TODO: What happens with negative levels?
activation.context.stage.child_by_depth(*level_id as i32) activation.context.stage.child_by_depth(*level_id as i32)
} }
Value::Object(object) => { Value::Object(object) if object.as_display_object().is_some() => {
if let Some(object) = object.as_display_object() { object.as_display_object()
Some(object)
} else {
return Ok(Value::Undefined);
}
} }
_ => return Ok(Value::Undefined), _ => return Ok(Value::Undefined),
}; };

View File

@ -208,7 +208,7 @@ impl WString {
fn with_wide_buf_if<W, F, R>(&mut self, wide: W, f: F) -> R fn with_wide_buf_if<W, F, R>(&mut self, wide: W, f: F) -> R
where where
W: FnOnce() -> bool, W: FnOnce() -> bool,
F: FnOnce(Units<&mut Vec<u8>, &mut Vec<u16>>) -> R, F: FnOnce(&mut Units<Vec<u8>, Vec<u16>>) -> R,
{ {
self.with_buf(|units| { self.with_buf(|units| {
if let Units::Bytes(buf) = units { if let Units::Bytes(buf) = units {
@ -219,11 +219,7 @@ impl WString {
} }
} }
let units_ref = match units { f(units)
Units::Bytes(buf) => Units::Bytes(buf),
Units::Wide(buf) => Units::Wide(buf),
};
f(units_ref)
}) })
} }