chore: Fix `clippy::uninlined_format_args` lints
This commit is contained in:
parent
f904f20796
commit
bd9078addf
|
@ -685,10 +685,7 @@ fn load_playerglobal<'gc>(
|
|||
Avm2::do_abc(&mut activation.context, do_abc, domain)
|
||||
.expect("playerglobal.swf should be valid");
|
||||
} else if tag_code != TagCode::End {
|
||||
panic!(
|
||||
"playerglobal should only contain `DoAbc` tag - found tag {:?}",
|
||||
tag_code
|
||||
)
|
||||
panic!("playerglobal should only contain `DoAbc` tag - found tag {tag_code:?}")
|
||||
}
|
||||
Ok(ControlFlow::Continue)
|
||||
};
|
||||
|
|
|
@ -524,8 +524,7 @@ pub fn set_name<'gc>(
|
|||
|
||||
if dobj.instantiated_by_timeline() {
|
||||
return Err(format!(
|
||||
"Display object {} was placed by the timeline and cannot have it's name changed.",
|
||||
new_name
|
||||
"Display object {new_name} was placed by the timeline and cannot have it's name changed.",
|
||||
)
|
||||
.into());
|
||||
}
|
||||
|
|
|
@ -143,10 +143,7 @@ pub fn get_child_at<'gc>(
|
|||
.unwrap_or(Value::Undefined)
|
||||
.coerce_to_i32(activation)?;
|
||||
let child = dobj.child_by_index(index as usize).ok_or_else(|| {
|
||||
format!(
|
||||
"RangeError: Display object container has no child with id {}",
|
||||
index
|
||||
)
|
||||
format!("RangeError: Display object container has no child with id {index}")
|
||||
})?;
|
||||
|
||||
return Ok(child.object2());
|
||||
|
|
|
@ -402,18 +402,14 @@ pub fn goto_frame<'gc>(
|
|||
let scene = scene.coerce_to_string(activation)?;
|
||||
if !mc.frame_exists_within_scene(&frame_or_label, &scene) {
|
||||
return Err(format!(
|
||||
"ArgumentError: Frame label {} not found in scene {}",
|
||||
frame_or_label, scene
|
||||
"ArgumentError: Frame label {frame_or_label} not found in scene {scene}",
|
||||
)
|
||||
.into());
|
||||
}
|
||||
}
|
||||
|
||||
mc.frame_label_to_number(&frame_or_label).ok_or_else(|| {
|
||||
format!(
|
||||
"ArgumentError: {} is not a valid frame label.",
|
||||
frame_or_label
|
||||
)
|
||||
format!("ArgumentError: {frame_or_label} is not a valid frame label.")
|
||||
})? as u32
|
||||
}
|
||||
}
|
||||
|
|
|
@ -110,7 +110,7 @@ pub fn set_vertex_buffer_at<'gc>(
|
|||
} else if &*format == b"bytes4" {
|
||||
Context3DVertexBufferFormat::Bytes4
|
||||
} else {
|
||||
panic!("Unknown vertex format {:?}", format);
|
||||
panic!("Unknown vertex format {format:?}");
|
||||
};
|
||||
|
||||
let buffer = buffer.as_vertex_buffer().unwrap();
|
||||
|
@ -231,7 +231,7 @@ pub fn set_program_constants_from_matrix<'gc>(
|
|||
} else if &*program_type == b"fragment" {
|
||||
ProgramType::Fragment
|
||||
} else {
|
||||
panic!("Unknown program type {:?}", program_type);
|
||||
panic!("Unknown program type {program_type:?}");
|
||||
};
|
||||
|
||||
let first_register = args
|
||||
|
|
|
@ -108,8 +108,7 @@ impl<'gc> PropertyClass<'gc> {
|
|||
}
|
||||
|
||||
return Err(Error::from(format!(
|
||||
"Attempted to perform (private) resolution of nonexistent type {:?}",
|
||||
name
|
||||
"Attempted to perform (private) resolution of nonexistent type {name:?}",
|
||||
)));
|
||||
}
|
||||
};
|
||||
|
|
|
@ -576,11 +576,11 @@ impl<'gc> Value<'gc> {
|
|||
Value::Object(num) => match num.value_of(mc)? {
|
||||
Value::Number(num) => Ok(num as i32),
|
||||
Value::Integer(num) => Ok(num),
|
||||
_ => Err(format!("Expected Number, int, or uint, found {:?}", self).into()),
|
||||
_ => Err(format!("Expected Number, int, or uint, found {self:?}").into()),
|
||||
},
|
||||
Value::Number(num) => Ok(*num as i32),
|
||||
Value::Integer(num) => Ok(*num),
|
||||
_ => Err(format!("Expected Number, int, or uint, found {:?}", self).into()),
|
||||
_ => Err(format!("Expected Number, int, or uint, found {self:?}").into()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -337,11 +337,7 @@ impl<'gc> VectorStorage<'gc> {
|
|||
};
|
||||
|
||||
if position >= self.storage.len() {
|
||||
Err(format!(
|
||||
"RangeError: Index {} extends beyond the end of the vector",
|
||||
position
|
||||
)
|
||||
.into())
|
||||
Err(format!("RangeError: Index {position} extends beyond the end of the vector").into())
|
||||
} else {
|
||||
Ok(self.storage.remove(position))
|
||||
}
|
||||
|
|
|
@ -1341,7 +1341,7 @@ pub trait TDisplayObject<'gc>:
|
|||
|
||||
#[cfg(feature = "avm_debug")]
|
||||
fn display_render_tree(&self, depth: usize) {
|
||||
let self_str = format!("{:?}", self);
|
||||
let self_str = format!("{self:?}");
|
||||
let paren = self_str.find('(').unwrap();
|
||||
let self_str = &self_str[..paren];
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#![allow(clippy::bool_to_int_with_if)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
#[macro_use]
|
||||
mod display_object;
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use gc_arena::MutationContext;
|
||||
use ruffle_render::backend::null::NullBitmapSource;
|
||||
use ruffle_render::backend::{
|
||||
|
@ -15,6 +11,7 @@ use ruffle_render::matrix::Matrix;
|
|||
use ruffle_render::shape_utils::{DistilledShape, DrawCommand, LineScaleMode, LineScales};
|
||||
use ruffle_render::transform::Transform;
|
||||
use ruffle_web_common::{JsError, JsResult};
|
||||
use std::sync::Arc;
|
||||
use swf::{BlendMode, Color};
|
||||
use wasm_bindgen::{Clamped, JsCast, JsValue};
|
||||
use web_sys::{
|
||||
|
|
|
@ -121,8 +121,7 @@ impl VertexAttributeFormat {
|
|||
VertexAttributeFormat::Float4 => base_expr,
|
||||
_ => {
|
||||
return Err(Error::Unimplemented(format!(
|
||||
"Unsupported conversion from {:?} to float4",
|
||||
self
|
||||
"Unsupported conversion from {self:?} to float4",
|
||||
)))
|
||||
}
|
||||
})
|
||||
|
@ -560,8 +559,7 @@ impl<'a> NagaBuilder<'a> {
|
|||
RegisterType::Varying => self.get_varying_pointer(dest.reg_num as usize)?,
|
||||
_ => {
|
||||
return Err(Error::Unimplemented(format!(
|
||||
"Unimplemented dest reg type: {:?}",
|
||||
dest
|
||||
"Unimplemented dest reg type: {dest:?}",
|
||||
)))
|
||||
}
|
||||
};
|
||||
|
@ -689,8 +687,7 @@ impl<'a> NagaBuilder<'a> {
|
|||
}
|
||||
_ => {
|
||||
return Err(Error::Unimplemented(format!(
|
||||
"Unimplemented opcode: {:?}",
|
||||
opcode
|
||||
"Unimplemented opcode: {opcode:?}",
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#![allow(clippy::uninlined_format_args)]
|
||||
use naga::Module;
|
||||
|
||||
mod builder;
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#![allow(clippy::bool_to_int_with_if)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
use bytemuck::{Pod, Zeroable};
|
||||
|
||||
|
|
|
@ -1,7 +1,3 @@
|
|||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
use std::sync::Arc;
|
||||
|
||||
use crate::bitmaps::BitmapSamplers;
|
||||
use crate::descriptors::Quad;
|
||||
use crate::globals::Globals;
|
||||
|
@ -18,6 +14,7 @@ use once_cell::sync::OnceCell;
|
|||
use ruffle_render::bitmap::{BitmapHandle, BitmapHandleImpl};
|
||||
use ruffle_render::color_transform::ColorTransform;
|
||||
use ruffle_render::tessellator::{Gradient as TessGradient, GradientType, Vertex as TessVertex};
|
||||
use std::sync::Arc;
|
||||
pub use wgpu;
|
||||
|
||||
type Error = Box<dyn std::error::Error>;
|
||||
|
|
|
@ -42,7 +42,7 @@ fn create_shader(
|
|||
) -> wgpu::ShaderModule {
|
||||
const COMMON_SRC: &str = include_str!("../shaders/common.wgsl");
|
||||
let src = [COMMON_SRC, src].concat();
|
||||
let label = create_debug_label!("Shader {}", name,);
|
||||
let label = create_debug_label!("Shader {}", name);
|
||||
let desc = wgpu::ShaderModuleDescriptor {
|
||||
label: label.as_deref(),
|
||||
source: wgpu::ShaderSource::Wgsl(src.into()),
|
||||
|
|
|
@ -50,34 +50,14 @@ pub fn analyze(results: impl Iterator<Item = FileResults>) {
|
|||
println!();
|
||||
|
||||
if start > 0 {
|
||||
println!(
|
||||
"{:>digits$} movies panicked or crashed the scanner",
|
||||
start,
|
||||
digits = digits
|
||||
);
|
||||
println!("{start:>digits$} movies panicked or crashed the scanner");
|
||||
}
|
||||
|
||||
println!(
|
||||
"{:>digits$} movies failed when reading",
|
||||
read,
|
||||
digits = digits
|
||||
);
|
||||
println!(
|
||||
"{:>digits$} movies failed to decompress",
|
||||
decompress,
|
||||
digits = digits
|
||||
);
|
||||
println!("{read:>digits$} movies failed when reading");
|
||||
println!("{decompress:>digits$} movies failed to decompress");
|
||||
println!("{parse:>digits$} movies failed to parse");
|
||||
println!(
|
||||
"{:>digits$} movies failed to execute",
|
||||
execute,
|
||||
digits = digits
|
||||
);
|
||||
println!(
|
||||
"{:>digits$} movies completed without errors",
|
||||
complete,
|
||||
digits = digits
|
||||
);
|
||||
println!("{execute:>digits$} movies failed to execute");
|
||||
println!("{complete:>digits$} movies completed without errors");
|
||||
println!();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
use crate::analyze::analyze_main;
|
||||
use crate::cli_options::{Mode, Opt};
|
||||
use crate::execute::execute_report_main;
|
||||
|
|
|
@ -420,8 +420,7 @@ pub mod tests {
|
|||
let parsed_action = reader.read_action().unwrap();
|
||||
assert_eq!(
|
||||
parsed_action, expected_action,
|
||||
"Incorrectly parsed action.\nRead:\n{:?}\n\nExpected:\n{:?}",
|
||||
parsed_action, expected_action
|
||||
"Incorrectly parsed action.\nRead:\n{parsed_action:?}\n\nExpected:\n{expected_action:?}",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -478,8 +478,7 @@ mod tests {
|
|||
.unwrap();
|
||||
assert_eq!(
|
||||
written_bytes, expected_bytes,
|
||||
"Error writing action.\nTag:\n{:?}\n\nWrote:\n{:?}\n\nExpected:\n{:?}",
|
||||
action, written_bytes, expected_bytes
|
||||
"Error writing action.\nTag:\n{action:?}\n\nWrote:\n{written_bytes:?}\n\nExpected:\n{expected_bytes:?}",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -508,12 +508,7 @@ impl<'a> Reader<'a> {
|
|||
let byte = self.read_u8()?;
|
||||
let opcode = match OpCode::from_u8(byte) {
|
||||
Some(o) => o,
|
||||
None => {
|
||||
return Err(Error::invalid_data(format!(
|
||||
"Unknown ABC opcode {:#x}",
|
||||
byte
|
||||
)))
|
||||
}
|
||||
None => return Err(Error::invalid_data(format!("Unknown ABC opcode {byte:#x}"))),
|
||||
};
|
||||
|
||||
let op = match opcode {
|
||||
|
@ -898,8 +893,7 @@ pub mod tests {
|
|||
let parsed = reader.read().unwrap();
|
||||
assert_eq!(
|
||||
parsed, abc_file,
|
||||
"Incorrectly parsed ABC.\nRead:\n{:?}\n\nExpected:\n{:?}",
|
||||
parsed, abc_file
|
||||
"Incorrectly parsed ABC.\nRead:\n{parsed:?}\n\nExpected:\n{abc_file:?}",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1061,8 +1061,7 @@ pub mod tests {
|
|||
}
|
||||
assert_eq!(
|
||||
out, bytes,
|
||||
"Incorrectly written ABC.\nWritten:\n{:?}\n\nExpected:\n{:?}",
|
||||
out, bytes
|
||||
"Incorrectly written ABC.\nWritten:\n{out:?}\n\nExpected:\n{bytes:?}",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
//! writing SWF data.
|
||||
|
||||
#![allow(clippy::bool_to_int_with_if)]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
#[cfg(feature = "flate2")]
|
||||
extern crate flate2;
|
||||
|
|
|
@ -3012,8 +3012,7 @@ pub mod tests {
|
|||
};
|
||||
assert_eq!(
|
||||
parsed_tag, expected_tag,
|
||||
"Incorrectly parsed tag.\nRead:\n{:#?}\n\nExpected:\n{:#?}",
|
||||
parsed_tag, expected_tag
|
||||
"Incorrectly parsed tag.\nRead:\n{parsed_tag:#?}\n\nExpected:\n{expected_tag:#?}",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2691,8 +2691,7 @@ mod tests {
|
|||
.unwrap();
|
||||
assert_eq!(
|
||||
written_tag_bytes, expected_tag_bytes,
|
||||
"Error reading tag.\nTag:\n{:?}\n\nWrote:\n{:?}\n\nExpected:\n{:?}",
|
||||
tag, written_tag_bytes, expected_tag_bytes
|
||||
"Error reading tag.\nTag:\n{tag:?}\n\nWrote:\n{written_tag_bytes:?}\n\nExpected:\n{expected_tag_bytes:?}",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![allow(clippy::uninlined_format_args)]
|
||||
|
||||
//! Tests running SWFs in a headless Ruffle instance.
|
||||
//!
|
||||
//! Trace output can be compared with correct output from the official Flash Player.
|
||||
|
@ -944,8 +942,7 @@ fn external_interface_avm1() -> Result<(), Error> {
|
|||
let parroted =
|
||||
player_locked.call_internal_interface("parrot", vec!["Hello World!".into()]);
|
||||
player_locked.log_backend().avm_trace(&format!(
|
||||
"After calling `parrot` with a string: {:?}",
|
||||
parroted
|
||||
"After calling `parrot` with a string: {parroted:?}",
|
||||
));
|
||||
|
||||
let mut nested = BTreeMap::new();
|
||||
|
@ -970,8 +967,7 @@ fn external_interface_avm1() -> Result<(), Error> {
|
|||
let result = player_locked
|
||||
.call_internal_interface("callWith", vec!["trace".into(), root.into()]);
|
||||
player_locked.log_backend().avm_trace(&format!(
|
||||
"After calling `callWith` with a complex payload: {:?}",
|
||||
result
|
||||
"After calling `callWith` with a complex payload: {result:?}",
|
||||
));
|
||||
Ok(())
|
||||
},
|
||||
|
@ -1001,8 +997,7 @@ fn external_interface_avm2() -> Result<(), Error> {
|
|||
let parroted =
|
||||
player_locked.call_internal_interface("parrot", vec!["Hello World!".into()]);
|
||||
player_locked.log_backend().avm_trace(&format!(
|
||||
"After calling `parrot` with a string: {:?}",
|
||||
parroted
|
||||
"After calling `parrot` with a string: {parroted:?}",
|
||||
));
|
||||
|
||||
player_locked.call_internal_interface("freestanding", vec!["Hello World!".into()]);
|
||||
|
@ -1018,8 +1013,7 @@ fn external_interface_avm2() -> Result<(), Error> {
|
|||
let result =
|
||||
player_locked.call_internal_interface("callWith", vec!["trace".into(), root]);
|
||||
player_locked.log_backend().avm_trace(&format!(
|
||||
"After calling `callWith` with a complex payload: {:?}",
|
||||
result
|
||||
"After calling `callWith` with a complex payload: {result:?}",
|
||||
));
|
||||
Ok(())
|
||||
},
|
||||
|
@ -1534,10 +1528,7 @@ fn run_swf(
|
|||
if !matches {
|
||||
let actual_image_path = base_path.join(format!("actual-{suffix}.png"));
|
||||
actual_image.save_with_format(&actual_image_path, image::ImageFormat::Png)?;
|
||||
panic!(
|
||||
"Test output does not match expected image - saved actual image to {:?}",
|
||||
actual_image_path
|
||||
);
|
||||
panic!("Test output does not match expected image - saved actual image to {actual_image_path:?}");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
#![no_std]
|
||||
#![allow(clippy::uninlined_format_args)]
|
||||
//! Provides UCS2 string types for usage in AVM1 and AVM2.
|
||||
//!
|
||||
//! Internally, these types are represeted by a sequence of 1-byte or 2-bytes (wide) code units,
|
||||
|
@ -8,6 +6,8 @@
|
|||
//! To match Flash behavior, the string length is limited to 2³¹-1 code units;
|
||||
//! any attempt to create a longer string will panic.
|
||||
|
||||
#![no_std]
|
||||
|
||||
#[cfg_attr(test, macro_use)]
|
||||
extern crate alloc;
|
||||
|
||||
|
|
|
@ -96,8 +96,7 @@ mod int_parse {
|
|||
pub fn from_wstr_radix<T: IntParse>(s: &WStr, radix: u32) -> Option<T> {
|
||||
assert!(
|
||||
radix >= 2 && radix <= 36,
|
||||
"from_str_radix: radix must be between 2 and 36, got {}",
|
||||
radix
|
||||
"from_str_radix: radix must be between 2 and 36, got {radix}",
|
||||
);
|
||||
|
||||
let (is_neg, digits) = match s.get(0).map(u8::try_from) {
|
||||
|
|
|
@ -150,8 +150,7 @@ fn test_pattern<'a, P: Pattern<'a> + Clone + Debug>(
|
|||
let mut actual: Vec<_> = core::iter::from_fn(|| searcher.next_match()).collect();
|
||||
assert_eq!(
|
||||
actual, forwards,
|
||||
"incorrect forwards matching: haystack={:?}; pattern={:?}",
|
||||
haystack, pattern
|
||||
"incorrect forwards matching: haystack={haystack:?}; pattern={pattern:?}",
|
||||
);
|
||||
|
||||
searcher = pattern.clone().into_searcher(haystack);
|
||||
|
@ -160,9 +159,7 @@ fn test_pattern<'a, P: Pattern<'a> + Clone + Debug>(
|
|||
assert_eq!(
|
||||
actual,
|
||||
backwards.unwrap_or(forwards),
|
||||
"incorrect backwards matching: haystack={:?}; pattern={:?}",
|
||||
haystack,
|
||||
pattern
|
||||
"incorrect backwards matching: haystack={haystack:?}; pattern={pattern:?}",
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue