core: Fix Clippy lints on nightly

This commit is contained in:
Aaron Hill 2023-02-11 12:28:53 -06:00 committed by Nathan Adams
parent d6abf24a81
commit c597f9f996
32 changed files with 96 additions and 96 deletions

View File

@ -14,7 +14,4 @@ rustflags = [
# LONG-TERM: These lints are unhelpful.
"-Aclippy::manual_map", # Less readable: Suggests `opt.map(..)` instsead of `if let Some(opt) { .. }`
"-Aclippy::manual_range_contains", # Less readable: Suggests `(a..b).contains(n)` instead of `n >= a && n < b`
# TEMPORARY: Buggy lints that will hopefully be fixed soon.
"-Aclippy::needless_borrow", # https://github.com/rust-lang/rust-clippy/pull/8355
]

View File

@ -44,7 +44,7 @@ pub fn build_playerglobal(
// This will create 'playerglobal.abc', 'playerglobal.cpp', and 'playerglobal.h'
// in `out_dir`
let status = Command::new("java")
.args(&[
.args([
"-classpath",
&asc_path.to_string_lossy(),
"macromedia.asc.embedding.ScriptCompiler",
@ -142,7 +142,7 @@ fn flash_to_rust_path(path: &str) -> String {
// 'vertex_buffer_3d' instead of 'vertex_buffer3d'
if !component.ends_with("3D") {
// Do not split on a letter followed by a digit, so e.g. `atan2` won't become `atan_2`.
without_boundaries.extend(&[Boundary::UpperDigit, Boundary::LowerDigit]);
without_boundaries.extend([Boundary::UpperDigit, Boundary::LowerDigit]);
}
component
@ -176,7 +176,7 @@ fn rust_method_name_and_path(
// For example, a namespace of "flash.system" and a name of "Security"
// turns into the path "flash::system::security"
let multiname = &abc.constant_pool.multinames[parent.0 as usize - 1];
let ns = flash_to_rust_path(resolve_multiname_ns(&abc, multiname));
let ns = flash_to_rust_path(resolve_multiname_ns(abc, multiname));
if !ns.is_empty() {
path += &ns;
path += "::";
@ -184,20 +184,20 @@ fn rust_method_name_and_path(
flash_method_path += &ns;
flash_method_path += "::";
}
let name = resolve_multiname_name(&abc, multiname);
let name = resolve_multiname_name(abc, multiname);
path += &flash_to_rust_path(name);
path += "::";
flash_method_path += &name;
flash_method_path += name;
flash_method_path += "::";
} else {
// This is a freestanding function. Append its namespace (the package).
// For example, the freestanding function "flash.utils.getDefinitionByName"
// has a namespace of "flash.utils", which turns into the path
// "flash::utils"
let name = resolve_multiname_ns(&abc, trait_name);
let name = resolve_multiname_ns(abc, trait_name);
let ns = &flash_to_rust_path(name);
path += &ns;
path += ns;
flash_method_path += name;
if !ns.is_empty() {
path += "::";
@ -209,7 +209,7 @@ fn rust_method_name_and_path(
// name (e.g. `getDefinitionByName`)
path += prefix;
let name = resolve_multiname_name(&abc, trait_name);
let name = resolve_multiname_name(abc, trait_name);
path += &flash_to_rust_path(name);
flash_method_path += name;

View File

@ -487,8 +487,7 @@ pub fn flush<'gc>(
recursive_serialize(activation, data, &mut elements);
let mut lso = Lso::new(
elements,
&name
.split('/')
name.split('/')
.last()
.map(|e| e.to_string())
.unwrap_or_else(|| "<unknown>".to_string()),

View File

@ -182,7 +182,7 @@ impl<'gc> Avm2<'gc> {
Method::Native(method) => {
//This exists purely to check if the builtin is OK with being called with
//no parameters.
init_activation.resolve_parameters(&method.name, &[], &method.signature)?;
init_activation.resolve_parameters(method.name, &[], &method.signature)?;
init_activation
.context
.avm2

View File

@ -1141,7 +1141,7 @@ impl<'a, 'gc> Activation<'a, 'gc> {
};
if let Err(error) = result {
return self.handle_err(method, reader, &full_data, instruction_start, error);
return self.handle_err(method, reader, full_data, instruction_start, error);
}
result
} else if let Err(e) = op {

View File

@ -438,14 +438,14 @@ macro_rules! impl_read{
=>
{
impl ByteArrayStorage {
$( pub fn $method_name<'gc> (&self) -> Result<$data_type, EofError> {
$( pub fn $method_name (&self) -> Result<$data_type, EofError> {
Ok(match self.endian {
Endian::Big => <$data_type>::from_be_bytes(self.read_bytes($size)?.try_into().unwrap()),
Endian::Little => <$data_type>::from_le_bytes(self.read_bytes($size)?.try_into().unwrap())
})
} )*
$( pub fn $at_method_name<'gc> (&self, offset: usize) -> Result<$data_type, EofError> {
$( pub fn $at_method_name (&self, offset: usize) -> Result<$data_type, EofError> {
Ok(match self.endian {
Endian::Big => <$data_type>::from_be_bytes(self.read_at($size, offset)?.try_into().unwrap()),
Endian::Little => <$data_type>::from_le_bytes(self.read_at($size, offset)?.try_into().unwrap())

View File

@ -134,7 +134,7 @@ impl<'gc> Executable<'gc> {
}
let arguments = activation.resolve_parameters(
&bm.method.name,
bm.method.name,
arguments,
&bm.method.signature,
)?;
@ -199,7 +199,7 @@ impl<'gc> Executable<'gc> {
match self {
Executable::Native(NativeExecutable { method, .. }) => {
output.push_char('/');
output.push_utf8(&method.name)
output.push_utf8(method.name)
}
Executable::Action(BytecodeExecutable { method, .. }) => {
// NOTE: The name of a bytecode method refers to the name of the trait that contains the method,

View File

@ -202,8 +202,7 @@ pub fn flush<'gc>(
crate::avm2::amf::recursive_serialize(activation, data, &mut elements, AMFVersion::AMF3)?;
let mut lso = Lso::new(
elements,
&name
.split('/')
name.split('/')
.last()
.map(|e| e.to_string())
.unwrap_or_else(|| "<unknown>".to_string()),

View File

@ -110,7 +110,7 @@ impl<'gc> ScriptObject<'gc> {
// TODO: use a proper ClassObject here; purposefully crafted bytecode
// can observe (the lack of) it.
let mut base = ScriptObjectData::custom_new(None, None);
let vt = VTable::newcatch(mc, &qname);
let vt = VTable::newcatch(mc, qname);
base.set_vtable(vt);
base.install_instance_slots();

View File

@ -262,7 +262,7 @@ impl<'gc> RegExp<'gc> {
let mut start = 0;
while let Some(m) = self.find_utf16_match(*text, start) {
ret.push_str(&text[start..m.range.start]);
ret.push_str(&f(activation, &text, &m)?);
ret.push_str(&f(activation, text, &m)?);
start = m.range.end;

View File

@ -1364,7 +1364,7 @@ impl<'gc> BitmapData<'gc> {
commands: CommandList::new(),
gc_context: context.gc_context,
ui: context.ui,
library: &context.library,
library: context.library,
transform_stack: &mut transform_stack,
is_offscreen: true,
stage: context.stage,

View File

@ -383,7 +383,7 @@ impl<'gc> MovieClip<'gc> {
// TODO: Re-creating static data because preload step occurs after construction.
// Should be able to hoist this up somewhere, or use MaybeUninit.
let mut static_data = (&*self.0.read().static_data).clone();
let mut static_data = (*self.0.read().static_data).clone();
let data = self.0.read().static_data.swf.clone();
let (mut cur_frame, mut start_pos, next_preload_chunk, preload_symbol) = {
let read = static_data.preload_progress.read();
@ -2657,7 +2657,7 @@ impl<'gc> TInteractiveObject<'gc> for MovieClip<'gc> {
};
if let Some(frame_name) = frame_name {
if let Some(frame_number) = self.frame_label_to_number(frame_name, &context) {
if let Some(frame_number) = self.frame_label_to_number(frame_name, context) {
if self.is_button_mode(context) {
self.goto_frame(context, frame_number, true);
}

View File

@ -1,4 +1,6 @@
#![allow(clippy::bool_to_int_with_if)]
// This is a new lint with false positives, see https://github.com/rust-lang/rust-clippy/issues/10318
#![allow(clippy::extra_unused_type_parameters)]
#[macro_use]
mod display_object;

View File

@ -59,7 +59,7 @@ fn channel() -> String {
fn commit_hash() -> Option<String> {
Command::new("git")
.args(&["rev-parse", "--short", "HEAD"])
.args(["rev-parse", "--short", "HEAD"])
.output()
.ok()
.and_then(|r| String::from_utf8(r.stdout).ok())
@ -67,7 +67,7 @@ fn commit_hash() -> Option<String> {
fn commit_date() -> Option<String> {
Command::new("git")
.args(&["log", "-1", "--date=short", "--pretty=format:%cd"])
.args(["log", "-1", "--date=short", "--pretty=format:%cd"])
.output()
.ok()
.and_then(|r| String::from_utf8(r.stdout).ok())

View File

@ -80,7 +80,7 @@ impl StorageBackend for DiskStorageBackend {
}
if let Some(parent_dir) = path.parent() {
if !parent_dir.exists() {
if let Err(r) = fs::create_dir_all(&parent_dir) {
if let Err(r) = fs::create_dir_all(parent_dir) {
tracing::warn!("Unable to create storage dir {}", r);
return false;
}

View File

@ -92,7 +92,7 @@ fn take_screenshot(
size: SizeOpt,
skip_unsupported: bool,
) -> Result<Vec<RgbaImage>> {
let movie = SwfMovie::from_path(&swf_path, None).map_err(|e| anyhow!(e.to_string()))?;
let movie = SwfMovie::from_path(swf_path, None).map_err(|e| anyhow!(e.to_string()))?;
if movie.is_action_script_3() && skip_unsupported {
return Err(anyhow!("Skipping unsupported movie"));

View File

@ -1,5 +1,7 @@
#![allow(clippy::bool_to_int_with_if)]
#![deny(clippy::unwrap_used)]
// This is a new lint with false positives, see https://github.com/rust-lang/rust-clippy/issues/10318
#![allow(clippy::extra_unused_type_parameters)]
use bytemuck::{Pod, Zeroable};
use std::borrow::Cow;
@ -1032,9 +1034,7 @@ impl RenderBackend for WebGlRenderBackend {
let texture = self
.gl
.create_texture()
.ok_or(BitmapError::JavascriptError(
"Unable to create texture".into(),
))?;
.ok_or_else(|| BitmapError::JavascriptError("Unable to create texture".into()))?;
self.gl.bind_texture(Gl::TEXTURE_2D, Some(&texture));
self.gl
.tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_opt_u8_array(
@ -1077,7 +1077,7 @@ impl RenderBackend for WebGlRenderBackend {
) -> Result<(), BitmapError> {
let texture = &as_registry_data(handle).texture;
self.gl.bind_texture(Gl::TEXTURE_2D, Some(&texture));
self.gl.bind_texture(Gl::TEXTURE_2D, Some(texture));
self.gl
.tex_image_2d_with_i32_and_i32_and_i32_and_format_and_type_and_opt_u8_array(
@ -1137,7 +1137,7 @@ impl RenderBackend for WebGlRenderBackend {
self.renderbuffer_width, self.renderbuffer_height
));
return Cow::Owned(result.join("\n"));
Cow::Owned(result.join("\n"))
}
fn set_quality(&mut self, _quality: StageQuality) {}
@ -1335,7 +1335,7 @@ impl CommandHandler for WebGlRenderBackend {
}
DrawType::Bitmap(bitmap) => {
let texture = match &bitmap.handle {
Some(handle) => &as_registry_data(&handle).texture,
Some(handle) => &as_registry_data(handle).texture,
None => {
log::warn!("Tried to render a handleless bitmap");
continue;
@ -1350,7 +1350,7 @@ impl CommandHandler for WebGlRenderBackend {
// Bind texture.
self.gl.active_texture(Gl::TEXTURE0);
self.gl.bind_texture(Gl::TEXTURE_2D, Some(&texture));
self.gl.bind_texture(Gl::TEXTURE_2D, Some(texture));
program.uniform1i(&self.gl, ShaderUniform::BitmapTexture, 0);
// Set texture parameters.

View File

@ -60,7 +60,7 @@ impl TexturePool {
(texture, view)
}))
});
pool.take(&descriptors)
pool.take(descriptors)
}
pub fn get_globals(

View File

@ -318,7 +318,7 @@ impl WgpuContext3D {
NonZeroU64::new(data.len() as u64).unwrap(),
&self.descriptors.device,
)
.copy_from_slice(&data);
.copy_from_slice(data);
}
Context3DCommand::UploadToVertexBuffer {
@ -341,7 +341,7 @@ impl WgpuContext3D {
NonZeroU64::new(data.len() as u64).unwrap(),
&self.descriptors.device,
)
.copy_from_slice(&data);
.copy_from_slice(data);
}
Context3DCommand::DrawTriangles {
@ -490,7 +490,7 @@ impl WgpuContext3D {
// When the 'transposedMatrix' flag is false, it copies data *directly* from matrix.rawData,
// which is stored in column-major order
buffer_view.copy_from_slice(bytemuck::cast_slice::<f32, u8>(
&matrix_raw_data_column_major,
matrix_raw_data_column_major,
));
}
Context3DCommand::SetCulling { face } => {

View File

@ -105,7 +105,7 @@ impl Descriptors {
self.device
.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
label: create_debug_label!("Copy sRGB pipeline").as_deref(),
layout: Some(&copy_texture_pipeline_layout),
layout: Some(copy_texture_pipeline_layout),
vertex: wgpu::VertexState {
module: &self.shaders.copy_srgb_shader,
entry_point: "main_vertex",
@ -178,7 +178,7 @@ impl Descriptors {
self.device
.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
label: create_debug_label!("Copy pipeline").as_deref(),
layout: Some(&copy_texture_pipeline_layout),
layout: Some(copy_texture_pipeline_layout),
vertex: wgpu::VertexState {
module: &self.shaders.copy_shader,
entry_point: "main_vertex",

View File

@ -38,7 +38,7 @@ impl Globals {
let bind_group_label = create_debug_label!("Globals bind group");
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
label: bind_group_label.as_deref(),
layout: &layout,
layout,
entries: &[wgpu::BindGroupEntry {
binding: 0,
resource: buffer.as_entire_binding(),

View File

@ -1,3 +1,6 @@
// This is a new lint with false positives, see https://github.com/rust-lang/rust-clippy/issues/10318
#![allow(clippy::extra_unused_type_parameters)]
use crate::bitmaps::BitmapSamplers;
use crate::descriptors::Quad;
use crate::mesh::BitmapBinds;
@ -313,8 +316,8 @@ impl Texture {
};
bind.get_or_init(|| {
BitmapBinds::new(
&device,
&layout,
device,
layout,
samplers.get_sampler(false, smoothed),
&quad.texture_transforms,
0 as wgpu::BufferAddress,

View File

@ -189,7 +189,7 @@ impl PendingDrawType {
wgpu::BindGroupEntry {
binding: 0,
resource: wgpu::BindingResource::Buffer(wgpu::BufferBinding {
buffer: &uniform_buffer,
buffer: uniform_buffer,
offset: texture_transforms_index,
size: wgpu::BufferSize::new(
std::mem::size_of::<TextureTransforms>() as u64,
@ -199,7 +199,7 @@ impl PendingDrawType {
wgpu::BindGroupEntry {
binding: 1,
resource: wgpu::BindingResource::Buffer(wgpu::BufferBinding {
buffer: &uniform_buffer,
buffer: uniform_buffer,
offset: gradient,
size: wgpu::BufferSize::new(
std::mem::size_of::<GradientUniforms>() as u64,
@ -228,7 +228,7 @@ impl PendingDrawType {
descriptors
.bitmap_samplers
.get_sampler(is_repeating, is_smoothed),
&uniform_buffer,
uniform_buffer,
texture_transforms_index,
texture_view,
bind_group_label,
@ -271,12 +271,12 @@ impl BitmapBinds {
) -> Self {
let bind_group =
device.create_bind_group(&wgpu::BindGroupDescriptor {
layout: &layout,
layout,
entries: &[
wgpu::BindGroupEntry {
binding: 0,
resource: wgpu::BindingResource::Buffer(wgpu::BufferBinding {
buffer: &uniform_buffer,
buffer: uniform_buffer,
offset: texture_transforms,
size: wgpu::BufferSize::new(
std::mem::size_of::<TextureTransforms>() as u64
@ -289,7 +289,7 @@ impl BitmapBinds {
},
wgpu::BindGroupEntry {
binding: 2,
resource: wgpu::BindingResource::Sampler(&sampler),
resource: wgpu::BindingResource::Sampler(sampler),
},
],
label: label.as_deref(),

View File

@ -119,7 +119,7 @@ impl Pipelines {
&VERTEX_BUFFERS_DESCRIPTION_COLOR,
&colort_bindings,
wgpu::BlendState::PREMULTIPLIED_ALPHA_BLENDING,
&full_push_constants,
full_push_constants,
);
let gradient_bindings = if device.limits().max_push_constant_size > 0 {
@ -144,7 +144,7 @@ impl Pipelines {
&VERTEX_BUFFERS_DESCRIPTION_POS,
&gradient_bindings,
wgpu::BlendState::PREMULTIPLIED_ALPHA_BLENDING,
&full_push_constants,
full_push_constants,
)
}
};
@ -169,7 +169,7 @@ impl Pipelines {
&VERTEX_BUFFERS_DESCRIPTION_POS,
&complex_blend_bindings,
wgpu::BlendState::REPLACE,
&partial_push_constants,
partial_push_constants,
)
};
@ -197,7 +197,7 @@ impl Pipelines {
&VERTEX_BUFFERS_DESCRIPTION_POS,
&bitmap_blend_bindings,
blend.blend_state(),
&full_push_constants,
full_push_constants,
)
})
.collect::<Vec<_>>()
@ -224,7 +224,7 @@ impl Pipelines {
device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
label: None,
bind_group_layouts: &color_matrix_filter_bindings,
push_constant_ranges: &full_push_constants,
push_constant_ranges: full_push_constants,
});
let color_matrix_filter = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {
@ -277,7 +277,7 @@ impl Pipelines {
let blur_filter_layout = device.create_pipeline_layout(&wgpu::PipelineLayoutDescriptor {
label: None,
bind_group_layouts: &blur_filter_bindings,
push_constant_ranges: &full_push_constants,
push_constant_ranges: full_push_constants,
});
let blur_filter = device.create_render_pipeline(&wgpu::RenderPipelineDescriptor {

View File

@ -29,42 +29,42 @@ impl Shaders {
ShaderDefValue::Bool(device.limits().max_push_constant_size > 0),
);
let color_shader = make_shader(
&device,
device,
&mut composer,
&shader_defs,
"color.wgsl",
include_str!("../shaders/color.wgsl"),
);
let bitmap_shader = make_shader(
&device,
device,
&mut composer,
&shader_defs,
"bitmap.wgsl",
include_str!("../shaders/bitmap.wgsl"),
);
let copy_srgb_shader = make_shader(
&device,
device,
&mut composer,
&shader_defs,
"copy_srgb.wgsl",
include_str!("../shaders/copy_srgb.wgsl"),
);
let copy_shader = make_shader(
&device,
device,
&mut composer,
&shader_defs,
"copy.wgsl",
include_str!("../shaders/copy.wgsl"),
);
let color_matrix_filter = make_shader(
&device,
device,
&mut composer,
&shader_defs,
"filter/color_matrix.wgsl",
include_str!("../shaders/filter/color_matrix.wgsl"),
);
let blur_filter = make_shader(
&device,
device,
&mut composer,
&shader_defs,
"filter/blur.wgsl",
@ -144,7 +144,7 @@ fn make_shader(
.unwrap_or_else(|e| {
panic!(
"{name} failed to compile:\n{}\n{:#?}",
e.emit_to_string(&composer),
e.emit_to_string(composer),
e
)
}),

View File

@ -112,12 +112,12 @@ impl Surface {
},
wgpu::BindGroupEntry {
binding: 1,
resource: wgpu::BindingResource::TextureView(&target.color_view()),
resource: wgpu::BindingResource::TextureView(target.color_view()),
},
wgpu::BindGroupEntry {
binding: 2,
resource: wgpu::BindingResource::Sampler(
&descriptors.bitmap_samplers.get_sampler(false, false),
descriptors.bitmap_samplers.get_sampler(false, false),
),
},
],
@ -207,7 +207,7 @@ impl Surface {
texture_pool: &mut TexturePool,
) -> CommandTarget {
let target = CommandTarget::new(
&descriptors,
descriptors,
texture_pool,
self.size,
self.format,
@ -247,7 +247,7 @@ impl Surface {
.as_deref(),
color_attachments: &[target.color_attachments()],
depth_stencil_attachment: if needs_depth {
target.depth_attachment(&descriptors, texture_pool)
target.depth_attachment(descriptors, texture_pool)
} else {
None
},
@ -255,8 +255,8 @@ impl Surface {
render_pass.set_bind_group(0, target.globals().bind_group(), &[]);
let mut renderer = CommandRenderer::new(
&self.pipelines,
&meshes,
&descriptors,
meshes,
descriptors,
uniform_buffers,
color_buffers,
uniform_encoder,
@ -282,7 +282,7 @@ impl Surface {
};
let parent_blend_buffer =
parent.update_blend_buffer(&descriptors, texture_pool, draw_encoder);
parent.update_blend_buffer(descriptors, texture_pool, draw_encoder);
let blend_bind_group =
descriptors
@ -333,7 +333,7 @@ impl Surface {
.as_deref(),
color_attachments: &[target.color_attachments()],
depth_stencil_attachment: if needs_depth {
target.depth_attachment(&descriptors, texture_pool)
target.depth_attachment(descriptors, texture_pool)
} else {
None
},
@ -483,7 +483,7 @@ impl Surface {
filter: &ColorMatrixFilter,
) -> CommandTarget {
let target = CommandTarget::new(
&descriptors,
descriptors,
texture_pool,
wgpu::Extent3d {
width: source_size.0,
@ -537,7 +537,7 @@ impl Surface {
wgpu::BindGroupEntry {
binding: 2,
resource: wgpu::BindingResource::Sampler(
&descriptors.bitmap_samplers.get_sampler(false, false),
descriptors.bitmap_samplers.get_sampler(false, false),
),
},
],
@ -546,7 +546,7 @@ impl Surface {
.device
.create_buffer_init(&wgpu::util::BufferInitDescriptor {
label: create_debug_label!("Filter arguments").as_deref(),
contents: &bytemuck::cast_slice(&filter.matrix),
contents: bytemuck::cast_slice(&filter.matrix),
usage: wgpu::BufferUsages::UNIFORM,
});
let filter_group = descriptors
@ -615,7 +615,7 @@ impl Surface {
) -> CommandTarget {
let targets = [
CommandTarget::new(
&descriptors,
descriptors,
texture_pool,
wgpu::Extent3d {
width: source_size.0,
@ -627,7 +627,7 @@ impl Surface {
wgpu::Color::TRANSPARENT,
),
CommandTarget::new(
&descriptors,
descriptors,
texture_pool,
wgpu::Extent3d {
width: source_size.0,
@ -702,7 +702,7 @@ impl Surface {
wgpu::BindGroupEntry {
binding: 2,
resource: wgpu::BindingResource::Sampler(
&descriptors.bitmap_samplers.get_sampler(false, true),
descriptors.bitmap_samplers.get_sampler(false, true),
),
},
],
@ -711,7 +711,7 @@ impl Surface {
.device
.create_buffer_init(&wgpu::util::BufferInitDescriptor {
label: create_debug_label!("Filter arguments").as_deref(),
contents: &bytemuck::cast_slice(&[
contents: bytemuck::cast_slice(&[
blur_x * ((i as u32) % 2) as f32,
blur_y * (((i as u32) % 2) + 1) as f32,
previous_width,

View File

@ -191,7 +191,7 @@ impl<'pass, 'frame: 'pass, 'global: 'frame> CommandRenderer<'pass, 'frame, 'glob
self.uniform_buffers.write_uniforms(
&self.descriptors.device,
&self.descriptors.bind_layouts.transforms,
&mut self.uniform_encoder,
self.uniform_encoder,
&mut self.render_pass,
1,
&Transforms { world_matrix },
@ -207,7 +207,7 @@ impl<'pass, 'frame: 'pass, 'global: 'frame> CommandRenderer<'pass, 'frame, 'glob
self.color_buffers.write_uniforms(
&self.descriptors.device,
&self.descriptors.bind_layouts.color_transforms,
&mut self.uniform_encoder,
self.uniform_encoder,
&mut self.render_pass,
2,
&ColorAdjustments::from(*color_adjustments),
@ -337,10 +337,10 @@ impl<'pass, 'frame: 'pass, 'global: 'frame> CommandRenderer<'pass, 'frame, 'glob
self.prep_color();
if color == &Color::WHITE {
self.apply_transform(&matrix, &ColorTransform::IDENTITY);
self.apply_transform(matrix, &ColorTransform::IDENTITY);
} else {
self.apply_transform(
&matrix,
matrix,
&ColorTransform {
r_mult: Fixed8::from_f32(f32::from(color.r) / 255.0),
g_mult: Fixed8::from_f32(f32::from(color.g) / 255.0),
@ -465,7 +465,7 @@ pub fn chunk_blends<'a>(
match command {
Command::Blend(commands, blend_mode) => {
let mut surface = Surface::new(
&descriptors,
descriptors,
quality,
width,
height,
@ -474,8 +474,8 @@ pub fn chunk_blends<'a>(
let clear_color = BlendType::from(blend_mode).default_color();
let target = surface.draw_commands(
clear_color,
&descriptors,
&meshes,
descriptors,
meshes,
commands,
uniform_buffers,
color_buffers,
@ -501,7 +501,7 @@ pub fn chunk_blends<'a>(
descriptors
.device
.create_bind_group(&wgpu::BindGroupDescriptor {
layout: &&descriptors.bind_layouts.bitmap,
layout: &descriptors.bind_layouts.bitmap,
entries: &[
wgpu::BindGroupEntry {
binding: 0,

View File

@ -153,7 +153,7 @@ impl CommandTarget {
clear_color: wgpu::Color,
) -> Self {
let frame_buffer = FrameBuffer::new(
&descriptors,
descriptors,
sample_count,
size,
format,
@ -169,7 +169,7 @@ impl CommandTarget {
let resolve_buffer = if sample_count > 1 {
Some(ResolveBuffer::new(
&descriptors,
descriptors,
size,
format,
wgpu::TextureUsages::COPY_SRC
@ -264,7 +264,7 @@ impl CommandTarget {
pub fn color_attachments(&self) -> Option<wgpu::RenderPassColorAttachment> {
Some(wgpu::RenderPassColorAttachment {
view: &self.frame_buffer.view(),
view: self.frame_buffer.view(),
resolve_target: self.resolve_buffer.as_ref().map(|b| b.view()),
ops: wgpu::Operations {
load: if self.color_needs_clear.set(false).is_ok() {
@ -311,7 +311,7 @@ impl CommandTarget {
) -> &BlendBuffer {
let blend_buffer = self.blend_buffer.get_or_init(|| {
BlendBuffer::new(
&descriptors,
descriptors,
self.size,
self.format,
wgpu::TextureUsages::TEXTURE_BINDING | wgpu::TextureUsages::COPY_DST,

View File

@ -72,7 +72,7 @@ impl<T: Pod> BufferStorage<T> {
let bind_group_label = create_debug_label!("Dynamic buffer bind group");
let bind_group = device.create_bind_group(&wgpu::BindGroupDescriptor {
label: bind_group_label.as_deref(),
layout: &layout,
layout,
entries: &[wgpu::BindGroupEntry {
binding: 0,
resource: wgpu::BindingResource::Buffer(wgpu::BufferBinding {

View File

@ -43,7 +43,7 @@ pub fn scan_file<P: AsRef<OsStr>>(exec_path: P, file: &DirEntry, name: &str) ->
let mut file_results = FileResults::new(name);
let subproc = Command::new(exec_path)
.args(&["execute-report", &file.path().to_string_lossy()])
.args(["execute-report", &file.path().to_string_lossy()])
.output();
match subproc {
Ok(output) => {

View File

@ -74,7 +74,7 @@ impl Approximations {
pub fn number_patterns(&self) -> Vec<Regex> {
self.number_patterns
.iter()
.map(|p| Regex::new(&p).unwrap())
.map(|p| Regex::new(p).unwrap())
.collect()
}
}

View File

@ -16,7 +16,7 @@ impl LocalStorageBackend {
impl StorageBackend for LocalStorageBackend {
fn get(&self, name: &str) -> Option<Vec<u8>> {
if let Ok(Some(data)) = self.storage.get(name) {
if let Ok(data) = BASE64_STANDARD.decode(&data) {
if let Ok(data) = BASE64_STANDARD.decode(data) {
return Some(data);
}
}