From 1fad7ba104a3049cdbf592d0663aa87deb9499f6 Mon Sep 17 00:00:00 2001 From: Bruce Mitchener Date: Wed, 18 Dec 2024 08:47:21 -0500 Subject: [PATCH] Fix and un-allow `elided_lifetimes_in_paths` lints (#771) --- examples/scenes/src/lib.rs | 7 ++- examples/scenes/src/svg.rs | 2 +- examples/scenes/src/test_scenes.rs | 50 +++++++++++----------- vello/src/debug/renderer.rs | 2 +- vello/src/lib.rs | 1 - vello/src/scene.rs | 4 +- vello/src/util.rs | 10 +++-- vello/src/wgpu_engine.rs | 16 +++---- vello_encoding/src/encoding.rs | 2 +- vello_encoding/src/lib.rs | 1 - vello_encoding/src/ramp_cache.rs | 2 +- vello_shaders/src/cpu.rs | 8 ++-- vello_shaders/src/cpu/backdrop.rs | 2 +- vello_shaders/src/cpu/bbox_clear.rs | 2 +- vello_shaders/src/cpu/binning.rs | 2 +- vello_shaders/src/cpu/clip_leaf.rs | 2 +- vello_shaders/src/cpu/clip_reduce.rs | 2 +- vello_shaders/src/cpu/coarse.rs | 2 +- vello_shaders/src/cpu/draw_leaf.rs | 2 +- vello_shaders/src/cpu/draw_reduce.rs | 2 +- vello_shaders/src/cpu/flatten.rs | 2 +- vello_shaders/src/cpu/path_count.rs | 2 +- vello_shaders/src/cpu/path_count_setup.rs | 2 +- vello_shaders/src/cpu/path_tiling.rs | 2 +- vello_shaders/src/cpu/path_tiling_setup.rs | 2 +- vello_shaders/src/cpu/pathtag_reduce.rs | 2 +- vello_shaders/src/cpu/pathtag_scan.rs | 2 +- vello_shaders/src/cpu/tile_alloc.rs | 2 +- vello_shaders/src/lib.rs | 1 - vello_tests/src/lib.rs | 1 - vello_tests/src/snapshot.rs | 6 +-- 31 files changed, 72 insertions(+), 73 deletions(-) diff --git a/examples/scenes/src/lib.rs b/examples/scenes/src/lib.rs index 322c773f3..9daf102eb 100644 --- a/examples/scenes/src/lib.rs +++ b/examples/scenes/src/lib.rs @@ -8,7 +8,6 @@ // Feel free to send a PR that solves one or more of these. #![allow( missing_debug_implementations, - elided_lifetimes_in_paths, single_use_lifetimes, unreachable_pub, missing_docs, @@ -67,11 +66,11 @@ pub struct ExampleScene { } pub trait TestScene { - fn render(&mut self, scene: &mut Scene, params: &mut SceneParams); + fn render(&mut self, scene: &mut Scene, params: &mut SceneParams<'_>); } -impl TestScene for F { - fn render(&mut self, scene: &mut Scene, params: &mut SceneParams) { +impl)> TestScene for F { + fn render(&mut self, scene: &mut Scene, params: &mut SceneParams<'_>) { self(scene, params); } } diff --git a/examples/scenes/src/svg.rs b/examples/scenes/src/svg.rs index 370596845..800f77272 100644 --- a/examples/scenes/src/svg.rs +++ b/examples/scenes/src/svg.rs @@ -106,7 +106,7 @@ fn render_svg_rec(items: &[crate::pico_svg::Item]) -> Scene { pub fn svg_function_of>( name: String, contents: impl FnOnce() -> R + Send + 'static, -) -> impl FnMut(&mut Scene, &mut SceneParams) { +) -> impl FnMut(&mut Scene, &mut SceneParams<'_>) { fn render_svg_contents(name: &str, contents: &str) -> (Scene, Vec2) { use crate::pico_svg::*; let start = Instant::now(); diff --git a/examples/scenes/src/test_scenes.rs b/examples/scenes/src/test_scenes.rs index 5fc93be25..a47768183 100644 --- a/examples/scenes/src/test_scenes.rs +++ b/examples/scenes/src/test_scenes.rs @@ -102,7 +102,7 @@ mod impls { const FLOWER_IMAGE: &[u8] = include_bytes!("../../assets/splash-flower.jpg"); - pub(super) fn emoji(scene: &mut Scene, params: &mut SceneParams) { + pub(super) fn emoji(scene: &mut Scene, params: &mut SceneParams<'_>) { let text_size = 120. + 20. * (params.time * 2.).sin() as f32; let s = "🎉🤠✅"; params.text.add_colr_emoji_run( @@ -123,7 +123,7 @@ mod impls { ); } - pub(super) fn funky_paths(scene: &mut Scene, _: &mut SceneParams) { + pub(super) fn funky_paths(scene: &mut Scene, _: &mut SceneParams<'_>) { use PathEl::*; let missing_movetos = [ MoveTo((0., 0.).into()), @@ -165,7 +165,7 @@ mod impls { ); } - pub(super) fn stroke_styles(transform: Affine) -> impl FnMut(&mut Scene, &mut SceneParams) { + pub(super) fn stroke_styles(transform: Affine) -> impl FnMut(&mut Scene, &mut SceneParams<'_>) { use PathEl::*; move |scene, params| { let colors = [ @@ -343,7 +343,7 @@ mod impls { // This test has been adapted from Skia's "trickycubicstrokes" GM slide which can be found at // `github.com/google/skia/blob/0d4d11451c4f4e184305cbdbd67f6b3edfa4b0e3/gm/trickycubicstrokes.cpp` - pub(super) fn tricky_strokes(scene: &mut Scene, params: &mut SceneParams) { + pub(super) fn tricky_strokes(scene: &mut Scene, params: &mut SceneParams<'_>) { use PathEl::*; let colors = [ Color::from_rgba8(140, 181, 236, 255), @@ -529,7 +529,7 @@ mod impls { )); } - pub(super) fn fill_types(scene: &mut Scene, params: &mut SceneParams) { + pub(super) fn fill_types(scene: &mut Scene, params: &mut SceneParams<'_>) { use PathEl::*; params.resolution = Some((1400., 700.).into()); let rect = Rect::from_origin_size(Point::new(0., 0.), (500., 500.)); @@ -602,14 +602,14 @@ mod impls { } } - pub(super) fn cardioid_and_friends(scene: &mut Scene, _: &mut SceneParams) { + pub(super) fn cardioid_and_friends(scene: &mut Scene, _: &mut SceneParams<'_>) { render_cardioid(scene); render_clip_test(scene); render_alpha_test(scene); //render_tiger(scene, false); } - pub(super) fn longpathdash(cap: Cap) -> impl FnMut(&mut Scene, &mut SceneParams) { + pub(super) fn longpathdash(cap: Cap) -> impl FnMut(&mut Scene, &mut SceneParams<'_>) { use PathEl::*; move |scene, _| { let mut path = BezPath::new(); @@ -653,7 +653,7 @@ mod impls { } } - pub(super) fn animated_text(scene: &mut Scene, params: &mut SceneParams) { + pub(super) fn animated_text(scene: &mut Scene, params: &mut SceneParams<'_>) { // Uses the static array address as a cache key for expedience. Real code // should use a better strategy. let piet_logo = params @@ -770,7 +770,7 @@ mod impls { ); } - pub(super) fn brush_transform(scene: &mut Scene, params: &mut SceneParams) { + pub(super) fn brush_transform(scene: &mut Scene, params: &mut SceneParams<'_>) { let th = params.time; let linear = Gradient::new_linear((0.0, 0.0), (0.0, 200.0)).with_stops([ palette::css::RED, @@ -804,7 +804,7 @@ mod impls { ); } - pub(super) fn gradient_extend(scene: &mut Scene, params: &mut SceneParams) { + pub(super) fn gradient_extend(scene: &mut Scene, params: &mut SceneParams<'_>) { enum Kind { Linear, Radial, @@ -871,7 +871,7 @@ mod impls { params.resolution = Some((1200.0, 1200.0).into()); } - pub(super) fn two_point_radial(scene: &mut Scene, _params: &mut SceneParams) { + pub(super) fn two_point_radial(scene: &mut Scene, _params: &mut SceneParams<'_>) { pub(super) fn make( scene: &mut Scene, x0: f64, @@ -1039,7 +1039,7 @@ mod impls { } } - pub(super) fn blend_grid(scene: &mut Scene, _: &mut SceneParams) { + pub(super) fn blend_grid(scene: &mut Scene, _: &mut SceneParams<'_>) { const BLEND_MODES: &[Mix] = &[ Mix::Normal, Mix::Multiply, @@ -1067,7 +1067,7 @@ mod impls { } } - pub(super) fn deep_blend(scene: &mut Scene, params: &mut SceneParams) { + pub(super) fn deep_blend(scene: &mut Scene, params: &mut SceneParams<'_>) { params.resolution = Some(Vec2::new(1000., 1000.)); let main_rect = Rect::from_origin_size((10., 10.), (900., 900.)); scene.fill( @@ -1103,7 +1103,7 @@ mod impls { } } - pub(super) fn many_clips(scene: &mut Scene, params: &mut SceneParams) { + pub(super) fn many_clips(scene: &mut Scene, params: &mut SceneParams<'_>) { params.resolution = Some(Vec2::new(1000., 1000.)); let mut rng = StdRng::seed_from_u64(42); let mut base_tri = BezPath::new(); @@ -1270,7 +1270,7 @@ mod impls { fragment } - pub(super) fn conflation_artifacts(scene: &mut Scene, _: &mut SceneParams) { + pub(super) fn conflation_artifacts(scene: &mut Scene, _: &mut SceneParams<'_>) { use PathEl::*; const N: f64 = 50.0; const S: f64 = 4.0; @@ -1359,7 +1359,7 @@ mod impls { ); } - pub(super) fn labyrinth(scene: &mut Scene, _: &mut SceneParams) { + pub(super) fn labyrinth(scene: &mut Scene, _: &mut SceneParams<'_>) { use PathEl::*; let rows: &[[u8; 12]] = &[ @@ -1436,7 +1436,7 @@ mod impls { ); } - pub(super) fn robust_paths(scene: &mut Scene, _: &mut SceneParams) { + pub(super) fn robust_paths(scene: &mut Scene, _: &mut SceneParams<'_>) { let mut path = BezPath::new(); path.move_to((16.0, 16.0)); path.line_to((32.0, 16.0)); @@ -1519,7 +1519,7 @@ mod impls { ); } - pub(super) fn base_color_test(scene: &mut Scene, params: &mut SceneParams) { + pub(super) fn base_color_test(scene: &mut Scene, params: &mut SceneParams<'_>) { // Cycle through the hue value every 5 seconds (t % 5) * 360/5 let color = AlphaColor::::new([80., 80., (params.time % 5.) as f32 * 72., 1.]); params.base_color = Some(color.convert()); @@ -1534,7 +1534,7 @@ mod impls { ); } - pub(super) fn clip_test(scene: &mut Scene, params: &mut SceneParams) { + pub(super) fn clip_test(scene: &mut Scene, params: &mut SceneParams<'_>) { let clip = { const X0: f64 = 50.0; const Y0: f64 = 0.0; @@ -1639,7 +1639,7 @@ mod impls { ] } - pub(super) fn many_draw_objects(scene: &mut Scene, params: &mut SceneParams) { + pub(super) fn many_draw_objects(scene: &mut Scene, params: &mut SceneParams<'_>) { const N_WIDE: usize = 300; const N_HIGH: usize = 300; const SCENE_WIDTH: f64 = 2000.0; @@ -1661,7 +1661,7 @@ mod impls { } } - pub(super) fn splash_screen(scene: &mut Scene, params: &mut SceneParams) { + pub(super) fn splash_screen(scene: &mut Scene, params: &mut SceneParams<'_>) { let strings = [ "Vello test", " Arrow keys: switch scenes", @@ -1686,7 +1686,7 @@ mod impls { } } - pub(super) fn splash_with_tiger() -> impl FnMut(&mut Scene, &mut SceneParams) { + pub(super) fn splash_with_tiger() -> impl FnMut(&mut Scene, &mut SceneParams<'_>) { let contents = include_str!(concat!( env!("CARGO_MANIFEST_DIR"), "/../assets/Ghostscript_Tiger.svg" @@ -1699,7 +1699,7 @@ mod impls { } } - pub(super) fn blurred_rounded_rect(scene: &mut Scene, params: &mut SceneParams) { + pub(super) fn blurred_rounded_rect(scene: &mut Scene, params: &mut SceneParams<'_>) { params.resolution = Some(Vec2::new(1200., 1200.)); params.base_color = Some(palette::css::WHITE); @@ -1764,7 +1764,7 @@ mod impls { ); } - pub(super) fn image_sampling(scene: &mut Scene, params: &mut SceneParams) { + pub(super) fn image_sampling(scene: &mut Scene, params: &mut SceneParams<'_>) { params.resolution = Some(Vec2::new(1100., 1100.)); params.base_color = Some(palette::css::WHITE); let mut blob: Vec = Vec::new(); @@ -1807,7 +1807,7 @@ mod impls { ); } - pub(super) fn image_extend_modes(scene: &mut Scene, params: &mut SceneParams) { + pub(super) fn image_extend_modes(scene: &mut Scene, params: &mut SceneParams<'_>) { params.resolution = Some(Vec2::new(1500., 1500.)); params.base_color = Some(palette::css::WHITE); let mut blob: Vec = Vec::new(); diff --git a/vello/src/debug/renderer.rs b/vello/src/debug/renderer.rs index 8b0325131..8a1a7519c 100644 --- a/vello/src/debug/renderer.rs +++ b/vello/src/debug/renderer.rs @@ -220,7 +220,7 @@ impl DebugRenderer { captured: &CapturedBuffers, bump: &BumpAllocators, params: &RenderParams, - downloads: &DebugDownloads, + downloads: &DebugDownloads<'_>, layers: DebugLayers, ) { if layers.is_empty() { diff --git a/vello/src/lib.rs b/vello/src/lib.rs index 8438347df..16980016c 100644 --- a/vello/src/lib.rs +++ b/vello/src/lib.rs @@ -98,7 +98,6 @@ #![allow(missing_docs, reason = "We have many as-yet undocumented items.")] #![expect( missing_debug_implementations, - elided_lifetimes_in_paths, single_use_lifetimes, unnameable_types, unreachable_pub, diff --git a/vello/src/scene.rs b/vello/src/scene.rs index 013322457..e76145993 100644 --- a/vello/src/scene.rs +++ b/vello/src/scene.rs @@ -301,7 +301,7 @@ impl Scene { } /// Returns a builder for encoding a glyph run. - pub fn draw_glyphs(&mut self, font: &Font) -> DrawGlyphs { + pub fn draw_glyphs(&mut self, font: &Font) -> DrawGlyphs<'_> { // TODO: Integrate `BumpEstimator` with the glyph cache. DrawGlyphs::new(self, font) } @@ -931,7 +931,7 @@ fn conv_skrifa_transform(transform: skrifa::color::Transform) -> Transform { } fn conv_brush( - brush: skrifa::color::Brush, + brush: skrifa::color::Brush<'_>, cpal: &Cpal<'_>, foreground_brush: BrushRef<'_>, ) -> Brush { diff --git a/vello/src/util.rs b/vello/src/util.rs index b33c225a3..65d8008c3 100644 --- a/vello/src/util.rs +++ b/vello/src/util.rs @@ -100,18 +100,22 @@ impl RenderContext { } /// Resizes the surface to the new dimensions. - pub fn resize_surface(&self, surface: &mut RenderSurface, width: u32, height: u32) { + pub fn resize_surface(&self, surface: &mut RenderSurface<'_>, width: u32, height: u32) { surface.config.width = width; surface.config.height = height; self.configure_surface(surface); } - pub fn set_present_mode(&self, surface: &mut RenderSurface, present_mode: wgpu::PresentMode) { + pub fn set_present_mode( + &self, + surface: &mut RenderSurface<'_>, + present_mode: wgpu::PresentMode, + ) { surface.config.present_mode = present_mode; self.configure_surface(surface); } - fn configure_surface(&self, surface: &RenderSurface) { + fn configure_surface(&self, surface: &RenderSurface<'_>) { let device = &self.devices[surface.dev_id].device; surface.surface.configure(device, &surface.config); } diff --git a/vello/src/wgpu_engine.rs b/vello/src/wgpu_engine.rs index 640b35805..2107fdec1 100644 --- a/vello/src/wgpu_engine.rs +++ b/vello/src/wgpu_engine.rs @@ -55,13 +55,13 @@ struct WgpuShader { } pub(crate) enum CpuShaderType { - Present(fn(u32, &[CpuBinding])), + Present(fn(u32, &[CpuBinding<'_>])), Missing, Skipped, } struct CpuShader { - shader: fn(u32, &[CpuBinding]), + shader: fn(u32, &[CpuBinding<'_>]), } enum ShaderKind<'a> { @@ -76,7 +76,7 @@ struct Shader { } impl Shader { - fn select(&self) -> ShaderKind { + fn select(&self) -> ShaderKind<'_> { if let Some(cpu) = self.cpu.as_ref() { ShaderKind::Cpu(cpu) } else if let Some(wgpu) = self.wgpu.as_ref() { @@ -309,7 +309,7 @@ impl WgpuEngine { fragment_main: &'static str, topology: wgpu::PrimitiveTopology, color_attachment: wgpu::ColorTargetState, - vertex_buffer: Option, + vertex_buffer: Option>, bind_layout: &[(BindType, wgpu::ShaderStages)], ) -> ShaderId { let entries = Self::create_bind_group_layout_entries(bind_layout.iter().copied()); @@ -371,7 +371,7 @@ impl WgpuEngine { device: &Device, queue: &Queue, recording: &Recording, - external_resources: &[ExternalResource], + external_resources: &[ExternalResource<'_>], label: &'static str, #[cfg(feature = "wgpu-profiler")] profiler: &mut wgpu_profiler::GpuProfiler, ) -> Result<()> { @@ -859,7 +859,7 @@ impl BindMap { /// Get a CPU buffer. /// /// Panics if buffer is not present or is on GPU. - fn get_cpu_buf(&self, id: ResourceId) -> CpuBinding { + fn get_cpu_buf(&self, id: ResourceId) -> CpuBinding<'_> { match &self.buf_map[&id].buffer { MaterializedBuffer::Cpu(b) => CpuBinding::BufferRW(b), _ => panic!("getting cpu buffer, but it's on gpu"), @@ -993,7 +993,7 @@ impl BindMapBuffer { impl<'a> TransientBindMap<'a> { /// Create new transient bind map, seeded from external resources - fn new(external_resources: &'a [ExternalResource]) -> Self { + fn new(external_resources: &'a [ExternalResource<'_>]) -> Self { let mut bufs = HashMap::default(); let mut images = HashMap::default(); for resource in external_resources { @@ -1167,7 +1167,7 @@ impl<'a> TransientBindMap<'a> { &self, bind_map: &'a mut BindMap, bindings: &[ResourceProxy], - ) -> Vec { + ) -> Vec> { // First pass is mutable; create buffers as needed for resource in bindings { match resource { diff --git a/vello_encoding/src/encoding.rs b/vello_encoding/src/encoding.rs index 9c1cf46d9..d581acd42 100644 --- a/vello_encoding/src/encoding.rs +++ b/vello_encoding/src/encoding.rs @@ -213,7 +213,7 @@ impl Encoding { /// Returns an encoder for encoding a path. If `is_fill` is true, all subpaths will /// be automatically closed. - pub fn encode_path(&mut self, is_fill: bool) -> PathEncoder { + pub fn encode_path(&mut self, is_fill: bool) -> PathEncoder<'_> { PathEncoder::new( &mut self.path_tags, &mut self.path_data, diff --git a/vello_encoding/src/lib.rs b/vello_encoding/src/lib.rs index 0d63945aa..eb78296ed 100644 --- a/vello_encoding/src/lib.rs +++ b/vello_encoding/src/lib.rs @@ -20,7 +20,6 @@ #![allow(missing_docs, reason = "We have many as-yet undocumented items.")] #![expect( missing_debug_implementations, - elided_lifetimes_in_paths, single_use_lifetimes, clippy::return_self_not_must_use, clippy::unseparated_literal_suffix, diff --git a/vello_encoding/src/ramp_cache.rs b/vello_encoding/src/ramp_cache.rs index 4ddd423fa..47d30b3e9 100644 --- a/vello_encoding/src/ramp_cache.rs +++ b/vello_encoding/src/ramp_cache.rs @@ -71,7 +71,7 @@ impl RampCache { } } - pub(crate) fn ramps(&self) -> Ramps { + pub(crate) fn ramps(&self) -> Ramps<'_> { Ramps { data: &self.data, width: N_SAMPLES as u32, diff --git a/vello_shaders/src/cpu.rs b/vello_shaders/src/cpu.rs index 3e87ddcf6..0804283f4 100644 --- a/vello_shaders/src/cpu.rs +++ b/vello_shaders/src/cpu.rs @@ -103,7 +103,7 @@ impl DerefMut for TypedBufGuardMut<'_, T> { } impl CpuBinding<'_> { - pub fn as_typed(&self) -> TypedBufGuard { + pub fn as_typed(&self) -> TypedBufGuard<'_, T> { match self { CpuBinding::Buffer(b) => TypedBufGuard::Slice(bytemuck::from_bytes(b)), CpuBinding::BufferRW(b) => { @@ -113,7 +113,7 @@ impl CpuBinding<'_> { } } - pub fn as_typed_mut(&self) -> TypedBufGuardMut { + pub fn as_typed_mut(&self) -> TypedBufGuardMut<'_, T> { match self { CpuBinding::Buffer(_) => panic!("can't borrow external buffer mutably"), CpuBinding::BufferRW(b) => { @@ -125,7 +125,7 @@ impl CpuBinding<'_> { } } - pub fn as_slice(&self) -> TypedBufGuard<[T]> { + pub fn as_slice(&self) -> TypedBufGuard<'_, [T]> { match self { CpuBinding::Buffer(b) => TypedBufGuard::Slice(bytemuck::cast_slice(b)), CpuBinding::BufferRW(b) => { @@ -135,7 +135,7 @@ impl CpuBinding<'_> { } } - pub fn as_slice_mut(&self) -> TypedBufGuardMut<[T]> { + pub fn as_slice_mut(&self) -> TypedBufGuardMut<'_, [T]> { match self { CpuBinding::Buffer(_) => panic!("can't borrow external buffer mutably"), CpuBinding::BufferRW(b) => { diff --git a/vello_shaders/src/cpu/backdrop.rs b/vello_shaders/src/cpu/backdrop.rs index 41303e1f7..7539a9808 100644 --- a/vello_shaders/src/cpu/backdrop.rs +++ b/vello_shaders/src/cpu/backdrop.rs @@ -22,7 +22,7 @@ fn backdrop_main(config: &ConfigUniform, _: &BumpAllocators, paths: &[Path], til } } -pub fn backdrop(_n_wg: u32, resources: &[CpuBinding]) { +pub fn backdrop(_n_wg: u32, resources: &[CpuBinding<'_>]) { let config = resources[0].as_typed(); let bump = resources[1].as_typed(); let paths = resources[2].as_slice(); diff --git a/vello_shaders/src/cpu/bbox_clear.rs b/vello_shaders/src/cpu/bbox_clear.rs index c58d40ca2..5932f2863 100644 --- a/vello_shaders/src/cpu/bbox_clear.rs +++ b/vello_shaders/src/cpu/bbox_clear.rs @@ -14,7 +14,7 @@ fn bbox_clear_main(config: &ConfigUniform, path_bboxes: &mut [PathBbox]) { } } -pub fn bbox_clear(_n_wg: u32, resources: &[CpuBinding]) { +pub fn bbox_clear(_n_wg: u32, resources: &[CpuBinding<'_>]) { let config = resources[0].as_typed(); let mut path_bboxes = resources[1].as_slice_mut(); bbox_clear_main(&config, &mut path_bboxes); diff --git a/vello_shaders/src/cpu/binning.rs b/vello_shaders/src/cpu/binning.rs index 870cbee6b..05a27c168 100644 --- a/vello_shaders/src/cpu/binning.rs +++ b/vello_shaders/src/cpu/binning.rs @@ -103,7 +103,7 @@ fn binning_main( } } -pub fn binning(n_wg: u32, resources: &[CpuBinding]) { +pub fn binning(n_wg: u32, resources: &[CpuBinding<'_>]) { let config = resources[0].as_typed(); let draw_monoids = resources[1].as_slice(); let path_bbox_buf = resources[2].as_slice(); diff --git a/vello_shaders/src/cpu/clip_leaf.rs b/vello_shaders/src/cpu/clip_leaf.rs index b1dfa6209..62d3bcdb3 100644 --- a/vello_shaders/src/cpu/clip_leaf.rs +++ b/vello_shaders/src/cpu/clip_leaf.rs @@ -70,7 +70,7 @@ fn clip_leaf_main( } } -pub fn clip_leaf(_n_wg: u32, resources: &[CpuBinding]) { +pub fn clip_leaf(_n_wg: u32, resources: &[CpuBinding<'_>]) { let config = resources[0].as_typed(); let clip_inp = resources[1].as_slice(); let path_bboxes = resources[2].as_slice(); diff --git a/vello_shaders/src/cpu/clip_reduce.rs b/vello_shaders/src/cpu/clip_reduce.rs index 71ad912f3..88bae8571 100644 --- a/vello_shaders/src/cpu/clip_reduce.rs +++ b/vello_shaders/src/cpu/clip_reduce.rs @@ -47,7 +47,7 @@ fn clip_reduce_main( } } -pub fn clip_reduce(n_wg: u32, resources: &[CpuBinding]) { +pub fn clip_reduce(n_wg: u32, resources: &[CpuBinding<'_>]) { let clip_inp = resources[0].as_slice(); let path_bboxes = resources[1].as_slice(); let mut reduced = resources[2].as_slice_mut(); diff --git a/vello_shaders/src/cpu/coarse.rs b/vello_shaders/src/cpu/coarse.rs index 3c164632d..46150a18f 100644 --- a/vello_shaders/src/cpu/coarse.rs +++ b/vello_shaders/src/cpu/coarse.rs @@ -383,7 +383,7 @@ fn coarse_main( } } -pub fn coarse(_n_wg: u32, resources: &[CpuBinding]) { +pub fn coarse(_n_wg: u32, resources: &[CpuBinding<'_>]) { let config = resources[0].as_typed(); let scene = resources[1].as_slice(); let draw_monoids = resources[2].as_slice(); diff --git a/vello_shaders/src/cpu/draw_leaf.rs b/vello_shaders/src/cpu/draw_leaf.rs index 0fa5bb2c8..7c772b81f 100644 --- a/vello_shaders/src/cpu/draw_leaf.rs +++ b/vello_shaders/src/cpu/draw_leaf.rs @@ -207,7 +207,7 @@ fn draw_leaf_main( } } -pub fn draw_leaf(n_wg: u32, resources: &[CpuBinding]) { +pub fn draw_leaf(n_wg: u32, resources: &[CpuBinding<'_>]) { let config = resources[0].as_typed(); let scene = resources[1].as_slice(); let reduced = resources[2].as_slice(); diff --git a/vello_shaders/src/cpu/draw_reduce.rs b/vello_shaders/src/cpu/draw_reduce.rs index 08133e73e..6217666d1 100644 --- a/vello_shaders/src/cpu/draw_reduce.rs +++ b/vello_shaders/src/cpu/draw_reduce.rs @@ -24,7 +24,7 @@ fn draw_reduce_main(n_wg: u32, config: &ConfigUniform, scene: &[u32], reduced: & } } -pub fn draw_reduce(n_wg: u32, resources: &[CpuBinding]) { +pub fn draw_reduce(n_wg: u32, resources: &[CpuBinding<'_>]) { let config = resources[0].as_typed(); let scene = resources[1].as_slice(); let mut reduced = resources[2].as_slice_mut(); diff --git a/vello_shaders/src/cpu/flatten.rs b/vello_shaders/src/cpu/flatten.rs index d4e51d251..f01b893dd 100644 --- a/vello_shaders/src/cpu/flatten.rs +++ b/vello_shaders/src/cpu/flatten.rs @@ -841,7 +841,7 @@ fn flatten_main( bump.lines = line_ix as u32; } -pub fn flatten(n_wg: u32, resources: &[CpuBinding]) { +pub fn flatten(n_wg: u32, resources: &[CpuBinding<'_>]) { let config = resources[0].as_typed(); let scene = resources[1].as_slice(); let tag_monoids = resources[2].as_slice(); diff --git a/vello_shaders/src/cpu/path_count.rs b/vello_shaders/src/cpu/path_count.rs index 62708cdb5..58f5971bf 100644 --- a/vello_shaders/src/cpu/path_count.rs +++ b/vello_shaders/src/cpu/path_count.rs @@ -153,7 +153,7 @@ fn path_count_main( } } -pub fn path_count(_n_wg: u32, resources: &[CpuBinding]) { +pub fn path_count(_n_wg: u32, resources: &[CpuBinding<'_>]) { // config is binding 0 let mut bump = resources[1].as_typed_mut(); let lines = resources[2].as_slice(); diff --git a/vello_shaders/src/cpu/path_count_setup.rs b/vello_shaders/src/cpu/path_count_setup.rs index 819f0ad61..88da9fa8b 100644 --- a/vello_shaders/src/cpu/path_count_setup.rs +++ b/vello_shaders/src/cpu/path_count_setup.rs @@ -14,7 +14,7 @@ fn path_count_setup_main(bump: &BumpAllocators, indirect: &mut IndirectCount) { indirect.count_z = 1; } -pub fn path_count_setup(_n_wg: u32, resources: &[CpuBinding]) { +pub fn path_count_setup(_n_wg: u32, resources: &[CpuBinding<'_>]) { let bump = resources[0].as_typed(); let mut indirect = resources[1].as_typed_mut(); path_count_setup_main(&bump, &mut indirect); diff --git a/vello_shaders/src/cpu/path_tiling.rs b/vello_shaders/src/cpu/path_tiling.rs index fa0613c09..bf57898a3 100644 --- a/vello_shaders/src/cpu/path_tiling.rs +++ b/vello_shaders/src/cpu/path_tiling.rs @@ -165,7 +165,7 @@ fn path_tiling_main( } } -pub fn path_tiling(_n_wg: u32, resources: &[CpuBinding]) { +pub fn path_tiling(_n_wg: u32, resources: &[CpuBinding<'_>]) { let mut bump = resources[0].as_typed_mut(); let seg_counts = resources[1].as_slice(); let lines = resources[2].as_slice(); diff --git a/vello_shaders/src/cpu/path_tiling_setup.rs b/vello_shaders/src/cpu/path_tiling_setup.rs index e17faad03..72006af46 100644 --- a/vello_shaders/src/cpu/path_tiling_setup.rs +++ b/vello_shaders/src/cpu/path_tiling_setup.rs @@ -14,7 +14,7 @@ fn path_tiling_setup_main(bump: &BumpAllocators, indirect: &mut IndirectCount) { indirect.count_z = 1; } -pub fn path_tiling_setup(_n_wg: u32, resources: &[CpuBinding]) { +pub fn path_tiling_setup(_n_wg: u32, resources: &[CpuBinding<'_>]) { let bump = resources[0].as_typed(); let mut indirect = resources[1].as_typed_mut(); // binding 2 is ptcl, which we would need if we propagate failure diff --git a/vello_shaders/src/cpu/pathtag_reduce.rs b/vello_shaders/src/cpu/pathtag_reduce.rs index b7cc6b650..349728875 100644 --- a/vello_shaders/src/cpu/pathtag_reduce.rs +++ b/vello_shaders/src/cpu/pathtag_reduce.rs @@ -24,7 +24,7 @@ fn pathtag_reduce_main( } } -pub fn pathtag_reduce(n_wg: u32, resources: &[CpuBinding]) { +pub fn pathtag_reduce(n_wg: u32, resources: &[CpuBinding<'_>]) { let config = resources[0].as_typed(); let scene = resources[1].as_slice(); let mut reduced = resources[2].as_slice_mut(); diff --git a/vello_shaders/src/cpu/pathtag_scan.rs b/vello_shaders/src/cpu/pathtag_scan.rs index 9627b0e7d..a654cb96b 100644 --- a/vello_shaders/src/cpu/pathtag_scan.rs +++ b/vello_shaders/src/cpu/pathtag_scan.rs @@ -28,7 +28,7 @@ fn pathtag_scan_main( } } -pub fn pathtag_scan(n_wg: u32, resources: &[CpuBinding]) { +pub fn pathtag_scan(n_wg: u32, resources: &[CpuBinding<'_>]) { let config = resources[0].as_typed(); let scene = resources[1].as_slice(); let reduced = resources[2].as_slice(); diff --git a/vello_shaders/src/cpu/tile_alloc.rs b/vello_shaders/src/cpu/tile_alloc.rs index 9e15ea8cf..e67d0d9c9 100644 --- a/vello_shaders/src/cpu/tile_alloc.rs +++ b/vello_shaders/src/cpu/tile_alloc.rs @@ -54,7 +54,7 @@ fn tile_alloc_main( } } -pub fn tile_alloc(_n_wg: u32, resources: &[CpuBinding]) { +pub fn tile_alloc(_n_wg: u32, resources: &[CpuBinding<'_>]) { let config = resources[0].as_typed(); let scene = resources[1].as_slice(); let draw_bboxes = resources[2].as_slice(); diff --git a/vello_shaders/src/lib.rs b/vello_shaders/src/lib.rs index 54c063491..7f3babac8 100644 --- a/vello_shaders/src/lib.rs +++ b/vello_shaders/src/lib.rs @@ -38,7 +38,6 @@ reason = "Deferred" )] #![allow( - elided_lifetimes_in_paths, single_use_lifetimes, unnameable_types, clippy::cast_possible_truncation, diff --git a/vello_tests/src/lib.rs b/vello_tests/src/lib.rs index ddd2312e2..0d80792d5 100644 --- a/vello_tests/src/lib.rs +++ b/vello_tests/src/lib.rs @@ -18,7 +18,6 @@ // Feel free to send a PR that solves one or more of these. #![allow( missing_debug_implementations, - elided_lifetimes_in_paths, unreachable_pub, missing_docs, clippy::missing_assert_message, diff --git a/vello_tests/src/snapshot.rs b/vello_tests/src/snapshot.rs index 0e65e9a29..94c886ae1 100644 --- a/vello_tests/src/snapshot.rs +++ b/vello_tests/src/snapshot.rs @@ -75,7 +75,7 @@ impl Snapshot<'_> { } } - fn handle_failure(&mut self, message: fmt::Arguments) -> Result<()> { + fn handle_failure(&mut self, message: fmt::Arguments<'_>) -> Result<()> { if env_var_relates_to("VELLO_TEST_UPDATE", &self.params.name, self.params.use_cpu) { if !self.params.use_cpu { write_png_to_file( @@ -154,7 +154,7 @@ pub async fn snapshot_test( scene: Scene, params: &TestParams, directory: SnapshotDirectory, -) -> Result { +) -> Result> { let raw_rendered = render_then_debug(&scene, params).await?; snapshot_test_image(raw_rendered, params, directory) } @@ -167,7 +167,7 @@ pub fn snapshot_test_image( raw_rendered: Image, params: &TestParams, directory: SnapshotDirectory, -) -> Result { +) -> Result> { let reference_path = snapshot_dir(directory) .join(¶ms.name) .with_extension("png");