chore: Appease clippy

This commit is contained in:
relrelb 2022-05-06 10:19:57 +03:00 committed by Mike Welsh
parent d1d6b56615
commit f6153ff7c1
6 changed files with 11 additions and 8 deletions

View File

@ -1,5 +1,6 @@
use crate::avm1::activation::Activation; use crate::avm1::activation::Activation;
use crate::avm1::{AvmString, Object, ObjectPtr, TObject, Value}; use crate::avm1::{AvmString, Object, ObjectPtr, TObject, Value};
use std::fmt::Write;
#[allow(dead_code)] #[allow(dead_code)]
pub struct VariableDumper<'a> { pub struct VariableDumper<'a> {
@ -174,7 +175,9 @@ impl<'a> VariableDumper<'a> {
self.depth += 1; self.depth += 1;
for key in keys.into_iter() { for key in keys.into_iter() {
self.output.push_str(&format!("{}.{}", name, key)); self.output.push_str(name);
self.output.push('.');
let _ = write!(self.output, "{}", key);
self.output.push_str(" = "); self.output.push_str(" = ");
self.print_property(object, key, activation); self.print_property(object, key, activation);
self.output.push('\n'); self.output.push('\n');

View File

@ -114,7 +114,7 @@ impl Declaration {
/// ///
/// # Usage: /// # Usage:
/// ///
/// ```rust,ignored /// ```rust,ignore
/// const DECLS: &'static [Declaration] = declare_properties! { /// const DECLS: &'static [Declaration] = declare_properties! {
/// "length" => property(get_length); /// "length" => property(get_length);
/// "filters" => property(get_filters, set_filters); /// "filters" => property(get_filters, set_filters);
@ -126,7 +126,7 @@ impl Declaration {
/// "scale" => float(0.85); /// "scale" => float(0.85);
/// // all declarations can also specify attributes /// // all declarations can also specify attributes
/// "hidden" => string("shh!"; DONT_ENUM | DONT_DELETE | READ_ONLY); /// "hidden" => string("shh!"; DONT_ENUM | DONT_DELETE | READ_ONLY);
/// } /// };
/// ``` /// ```
macro_rules! declare_properties { macro_rules! declare_properties {
( $($name:literal => $kind:ident($($args:tt)*);)* ) => { ( $($name:literal => $kind:ident($($args:tt)*);)* ) => {

View File

@ -127,7 +127,7 @@ impl BitmapDataStorage {
.dyn_into() .dyn_into()
.unwrap(); .unwrap();
let _ = context.put_image_data(&data, 0.0, 0.0).unwrap(); context.put_image_data(&data, 0.0, 0.0).unwrap();
BitmapDataStorage::CanvasElement(canvas, context) BitmapDataStorage::CanvasElement(canvas, context)
} }

View File

@ -248,7 +248,7 @@ impl<'a> From<&'a str> for &'a SwfStr {
} }
} }
impl<'a, T: ?Sized + AsRef<str>> PartialEq<T> for SwfStr { impl<T: ?Sized + AsRef<str>> PartialEq<T> for SwfStr {
fn eq(&self, other: &T) -> bool { fn eq(&self, other: &T) -> bool {
&self.string == other.as_ref().as_bytes() &self.string == other.as_ref().as_bytes()
} }

View File

@ -122,7 +122,7 @@ struct SoundInstance {
impl Drop for SoundInstance { impl Drop for SoundInstance {
fn drop(&mut self) { fn drop(&mut self) {
if let SoundInstanceType::AudioBuffer(instance) = &self.instance_type { if let SoundInstanceType::AudioBuffer(instance) = &self.instance_type {
let _ = instance.buffer_source_node.set_onended(None); instance.buffer_source_node.set_onended(None);
let _ = instance.node.disconnect(); let _ = instance.node.disconnect();
} }
} }
@ -474,7 +474,7 @@ impl WebAudioBackend {
let closure = Closure::once_into_js(Box::new(ended_handler) as Box<dyn FnMut()>); let closure = Closure::once_into_js(Box::new(ended_handler) as Box<dyn FnMut()>);
// Note that we add the ended event to the AudioBufferSourceNode; an audio envelope adds more nodes // Note that we add the ended event to the AudioBufferSourceNode; an audio envelope adds more nodes
// in the graph, but these nodes don't fire the ended event. // in the graph, but these nodes don't fire the ended event.
let _ = buffer_source_node.set_onended(Some(closure.as_ref().unchecked_ref())); buffer_source_node.set_onended(Some(closure.as_ref().unchecked_ref()));
instance_handle instance_handle
} }

View File

@ -263,7 +263,7 @@ impl<'a, T: Copy, U: Copy + Eq + TryFrom<T>> Predicate<T> for AnyOf<'a, U> {
pub struct FnPred<F>(F); pub struct FnPred<F>(F);
impl<'a, T: Into<u16>, F: Fn(u16) -> bool> Predicate<T> for FnPred<F> { impl<T: Into<u16>, F: Fn(u16) -> bool> Predicate<T> for FnPred<F> {
fn is_match(&self, c: T) -> bool { fn is_match(&self, c: T) -> bool {
(self.0)(c.into()) (self.0)(c.into())
} }