From c8a5e3bb308414cf18b2a18490326ef2bd68a303 Mon Sep 17 00:00:00 2001 From: "Spencer C. Imbleau" Date: Sat, 9 Mar 2024 10:58:29 -0500 Subject: [PATCH 1/4] build: rustfmt --- rustfmt.toml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 rustfmt.toml diff --git a/rustfmt.toml b/rustfmt.toml new file mode 100644 index 0000000000..a18b909692 --- /dev/null +++ b/rustfmt.toml @@ -0,0 +1,3 @@ +max_width = 100 +use_field_init_shorthand = true +newline_style = "Unix" From 728eeee1f6d5fea1bed153d1a2b9648f34a8f6bc Mon Sep 17 00:00:00 2001 From: "Spencer C. Imbleau" Date: Sat, 9 Mar 2024 10:59:00 -0500 Subject: [PATCH 2/4] refactor: fmt --- crates/encoding/src/encoding.rs | 6 ++--- crates/encoding/src/glyph_cache.rs | 10 ++++----- crates/encoding/src/image_cache.rs | 3 ++- crates/encoding/src/path.rs | 6 ++--- crates/shaders/src/compile/mod.rs | 18 +++++---------- crates/shaders/src/compile/msl.rs | 6 ++--- crates/shaders/src/compile/preprocess.rs | 9 +++----- crates/tests/src/lib.rs | 15 +++++++------ crates/tests/tests/smoke.rs | 8 +++---- examples/headless/src/main.rs | 17 +++++--------- examples/scenes/src/download.rs | 6 ++--- examples/scenes/src/lib.rs | 4 +++- examples/scenes/src/mmark.rs | 9 ++++---- examples/scenes/src/simple_text.rs | 13 +++++------ examples/scenes/src/svg.rs | 9 ++++---- examples/simple/src/main.rs | 10 ++++----- examples/with_bevy/src/main.rs | 18 ++++++--------- examples/with_winit/src/hot_reload.rs | 6 +++-- examples/with_winit/src/lib.rs | 28 +++++++++++------------- examples/with_winit/src/stats.rs | 8 +++---- src/cpu_dispatch.rs | 6 ++--- src/cpu_shader/draw_leaf.rs | 2 +- src/cpu_shader/flatten.rs | 5 +++-- src/cpu_shader/path_tiling.rs | 6 ++--- src/glyph.rs | 23 +++++++++---------- src/recording.rs | 6 ++--- src/render.rs | 8 +++---- src/shaders/preprocess.rs | 4 +++- src/wgpu_engine.rs | 14 ++++++------ 29 files changed, 122 insertions(+), 161 deletions(-) diff --git a/crates/encoding/src/encoding.rs b/crates/encoding/src/encoding.rs index 9ff1e651d2..3c8fc12e29 100644 --- a/crates/encoding/src/encoding.rs +++ b/crates/encoding/src/encoding.rs @@ -3,10 +3,8 @@ use super::{DrawColor, DrawTag, PathEncoder, PathTag, Style, Transform}; -use peniko::{ - kurbo::{Shape, Stroke}, - BlendMode, BrushRef, Fill, -}; +use peniko::kurbo::{Shape, Stroke}; +use peniko::{BlendMode, BrushRef, Fill}; #[cfg(feature = "full")] use { diff --git a/crates/encoding/src/glyph_cache.rs b/crates/encoding/src/glyph_cache.rs index b83fd0a79d..fdbf7f9e5c 100644 --- a/crates/encoding/src/glyph_cache.rs +++ b/crates/encoding/src/glyph_cache.rs @@ -5,11 +5,11 @@ use std::collections::HashMap; use super::{Encoding, StreamOffsets}; -use peniko::{ - kurbo::{BezPath, Shape}, - Fill, Style, -}; -use skrifa::{instance::NormalizedCoord, outline::OutlinePen, GlyphId, OutlineGlyphCollection}; +use peniko::kurbo::{BezPath, Shape}; +use peniko::{Fill, Style}; +use skrifa::instance::NormalizedCoord; +use skrifa::outline::OutlinePen; +use skrifa::{GlyphId, OutlineGlyphCollection}; #[derive(Copy, Clone, PartialEq, Eq, Hash, Default, Debug)] pub struct GlyphKey { diff --git a/crates/encoding/src/image_cache.rs b/crates/encoding/src/image_cache.rs index f581dbb5dd..841466b6e5 100644 --- a/crates/encoding/src/image_cache.rs +++ b/crates/encoding/src/image_cache.rs @@ -3,7 +3,8 @@ use guillotiere::{size2, AtlasAllocator}; use peniko::Image; -use std::collections::{hash_map::Entry, HashMap}; +use std::collections::hash_map::Entry; +use std::collections::HashMap; const DEFAULT_ATLAS_SIZE: i32 = 1024; const MAX_ATLAS_SIZE: i32 = 8192; diff --git a/crates/encoding/src/path.rs b/crates/encoding/src/path.rs index 2ef59d02b1..c1a3ef3fa5 100644 --- a/crates/encoding/src/path.rs +++ b/crates/encoding/src/path.rs @@ -2,10 +2,8 @@ // SPDX-License-Identifier: Apache-2.0 OR MIT use bytemuck::{Pod, Zeroable}; -use peniko::{ - kurbo::{Cap, Join, Shape, Stroke}, - Fill, -}; +use peniko::kurbo::{Cap, Join, Shape, Stroke}; +use peniko::Fill; use super::Monoid; diff --git a/crates/shaders/src/compile/mod.rs b/crates/shaders/src/compile/mod.rs index 8cf0f06a6b..3f053c9afa 100644 --- a/crates/shaders/src/compile/mod.rs +++ b/crates/shaders/src/compile/mod.rs @@ -1,18 +1,12 @@ // Copyright 2023 the Vello Authors // SPDX-License-Identifier: Apache-2.0 OR MIT -use { - naga::{ - front::wgsl, - valid::{Capabilities, ModuleInfo, ValidationError, ValidationFlags}, - AddressSpace, ArraySize, ImageClass, Module, StorageAccess, WithSpan, - }, - std::{ - collections::{HashMap, HashSet}, - path::Path, - }, - thiserror::Error, -}; +use naga::front::wgsl; +use naga::valid::{Capabilities, ModuleInfo, ValidationError, ValidationFlags}; +use naga::{AddressSpace, ArraySize, ImageClass, Module, StorageAccess, WithSpan}; +use std::collections::{HashMap, HashSet}; +use std::path::Path; +use thiserror::Error; pub mod permutations; pub mod preprocess; diff --git a/crates/shaders/src/compile/msl.rs b/crates/shaders/src/compile/msl.rs index 135dce8189..e1f3a0576d 100644 --- a/crates/shaders/src/compile/msl.rs +++ b/crates/shaders/src/compile/msl.rs @@ -1,11 +1,9 @@ // Copyright 2023 the Vello Authors // SPDX-License-Identifier: Apache-2.0 OR MIT +use super::{BindType, ShaderInfo}; +use crate::types::msl::BindingIndex; use naga::back::msl as naga_msl; -use { - super::{BindType, ShaderInfo}, - crate::types::msl::BindingIndex, -}; pub fn translate(shader: &ShaderInfo) -> Result { let mut map = naga_msl::EntryPointResourceMap::default(); diff --git a/crates/shaders/src/compile/preprocess.rs b/crates/shaders/src/compile/preprocess.rs index 3c925a6c3e..313baa9cc9 100644 --- a/crates/shaders/src/compile/preprocess.rs +++ b/crates/shaders/src/compile/preprocess.rs @@ -1,12 +1,9 @@ // Copyright 2023 the Vello Authors // SPDX-License-Identifier: Apache-2.0 OR MIT -use std::{ - collections::{HashMap, HashSet}, - fs, - path::Path, - vec, -}; +use std::collections::{HashMap, HashSet}; +use std::path::Path; +use std::{fs, vec}; pub fn get_imports(shader_dir: &Path) -> HashMap { let mut imports = HashMap::new(); diff --git a/crates/tests/src/lib.rs b/crates/tests/src/lib.rs index cb6eb7685a..b916c6c703 100644 --- a/crates/tests/src/lib.rs +++ b/crates/tests/src/lib.rs @@ -1,15 +1,16 @@ // Copyright 2024 the Vello Authors // SPDX-License-Identifier: Apache-2.0 OR MIT -use std::{env, fs::File, num::NonZeroUsize, path::Path, sync::Arc}; +use std::env; +use std::fs::File; +use std::num::NonZeroUsize; +use std::path::Path; +use std::sync::Arc; use anyhow::{anyhow, bail, Result}; -use vello::{ - block_on_wgpu, - peniko::{Blob, Color, Format, Image}, - util::RenderContext, - RendererOptions, Scene, -}; +use vello::peniko::{Blob, Color, Format, Image}; +use vello::util::RenderContext; +use vello::{block_on_wgpu, RendererOptions, Scene}; use wgpu::{ BufferDescriptor, BufferUsages, CommandEncoderDescriptor, Extent3d, ImageCopyBuffer, TextureDescriptor, TextureFormat, TextureUsages, diff --git a/crates/tests/tests/smoke.rs b/crates/tests/tests/smoke.rs index 17920f3461..9f472588a2 100644 --- a/crates/tests/tests/smoke.rs +++ b/crates/tests/tests/smoke.rs @@ -1,11 +1,9 @@ // Copyright 2024 the Vello Authors // SPDX-License-Identifier: Apache-2.0 OR MIT -use vello::{ - kurbo::{Affine, Rect}, - peniko::{Brush, Color, Format}, - Scene, -}; +use vello::kurbo::{Affine, Rect}; +use vello::peniko::{Brush, Color, Format}; +use vello::Scene; use vello_tests::TestParams; #[test] diff --git a/examples/headless/src/main.rs b/examples/headless/src/main.rs index d0c7925ac3..29d4e304ad 100644 --- a/examples/headless/src/main.rs +++ b/examples/headless/src/main.rs @@ -1,21 +1,16 @@ // Copyright 2023 the Vello Authors // SPDX-License-Identifier: Apache-2.0 OR MIT -use std::{ - fs::File, - num::NonZeroUsize, - path::{Path, PathBuf}, -}; +use std::fs::File; +use std::num::NonZeroUsize; +use std::path::{Path, PathBuf}; use anyhow::{anyhow, bail, Context, Result}; use clap::{CommandFactory, Parser}; use scenes::{ImageCache, SceneParams, SceneSet, SimpleText}; -use vello::{ - block_on_wgpu, - kurbo::{Affine, Vec2}, - util::RenderContext, - RendererOptions, Scene, -}; +use vello::kurbo::{Affine, Vec2}; +use vello::util::RenderContext; +use vello::{block_on_wgpu, RendererOptions, Scene}; use wgpu::{ BufferDescriptor, BufferUsages, CommandEncoderDescriptor, Extent3d, ImageCopyBuffer, TextureDescriptor, TextureFormat, TextureUsages, diff --git a/examples/scenes/src/download.rs b/examples/scenes/src/download.rs index 2a0b69ccb9..b2153581d2 100644 --- a/examples/scenes/src/download.rs +++ b/examples/scenes/src/download.rs @@ -1,10 +1,8 @@ // Copyright 2022 the Vello Authors // SPDX-License-Identifier: Apache-2.0 OR MIT -use std::{ - io::Seek, - path::{Path, PathBuf}, -}; +use std::io::Seek; +use std::path::{Path, PathBuf}; use anyhow::{bail, Context, Result}; use byte_unit::Byte; diff --git a/examples/scenes/src/lib.rs b/examples/scenes/src/lib.rs index ece27e2b12..cc210cfb9a 100644 --- a/examples/scenes/src/lib.rs +++ b/examples/scenes/src/lib.rs @@ -19,7 +19,9 @@ pub use simple_text::SimpleText; pub use svg::{default_scene, scene_from_files}; pub use test_scenes::test_scenes; -use vello::{kurbo::Vec2, peniko::Color, Scene}; +use vello::kurbo::Vec2; +use vello::peniko::Color; +use vello::Scene; pub struct SceneParams<'a> { pub time: f64, diff --git a/examples/scenes/src/mmark.rs b/examples/scenes/src/mmark.rs index 85f28e2533..3deea8d79b 100644 --- a/examples/scenes/src/mmark.rs +++ b/examples/scenes/src/mmark.rs @@ -11,12 +11,11 @@ use std::cmp::Ordering; -use rand::{seq::SliceRandom, Rng}; +use rand::seq::SliceRandom; +use rand::Rng; +use vello::kurbo::{Affine, BezPath, CubicBez, Line, ParamCurve, PathSeg, Point, QuadBez, Stroke}; use vello::peniko::Color; -use vello::{ - kurbo::{Affine, BezPath, CubicBez, Line, ParamCurve, PathSeg, Point, QuadBez, Stroke}, - Scene, -}; +use vello::Scene; use crate::{SceneParams, TestScene}; diff --git a/examples/scenes/src/simple_text.rs b/examples/scenes/src/simple_text.rs index c2e8078ae9..c92e4f147c 100644 --- a/examples/scenes/src/simple_text.rs +++ b/examples/scenes/src/simple_text.rs @@ -3,13 +3,12 @@ use std::sync::Arc; -use vello::{ - glyph::Glyph, - kurbo::Affine, - peniko::{Blob, Brush, BrushRef, Font, StyleRef}, - skrifa::{raw::FontRef, MetadataProvider}, - Scene, -}; +use vello::glyph::Glyph; +use vello::kurbo::Affine; +use vello::peniko::{Blob, Brush, BrushRef, Font, StyleRef}; +use vello::skrifa::raw::FontRef; +use vello::skrifa::MetadataProvider; +use vello::Scene; // This is very much a hack to get things working. // On Windows, can set this to "c:\\Windows\\Fonts\\seguiemj.ttf" to get color emoji diff --git a/examples/scenes/src/svg.rs b/examples/scenes/src/svg.rs index 5c9a84982a..f14d3e9df1 100644 --- a/examples/scenes/src/svg.rs +++ b/examples/scenes/src/svg.rs @@ -1,14 +1,13 @@ // Copyright 2022 the Vello Authors // SPDX-License-Identifier: Apache-2.0 OR MIT -use std::{ - fs::read_dir, - path::{Path, PathBuf}, -}; +use std::fs::read_dir; +use std::path::{Path, PathBuf}; use anyhow::{Ok, Result}; use instant::Instant; -use vello::{kurbo::Vec2, Scene}; +use vello::kurbo::Vec2; +use vello::Scene; use vello_svg::usvg; use vello_svg::usvg::TreeParsing; diff --git a/examples/simple/src/main.rs b/examples/simple/src/main.rs index 84b8822bc4..98fb9c9003 100644 --- a/examples/simple/src/main.rs +++ b/examples/simple/src/main.rs @@ -8,12 +8,10 @@ use vello::kurbo::{Affine, Circle, Ellipse, Line, RoundedRect, Stroke}; use vello::peniko::Color; use vello::util::{RenderContext, RenderSurface}; use vello::{AaConfig, Renderer, RendererOptions, Scene}; -use winit::{ - dpi::LogicalSize, - event::*, - event_loop::{ControlFlow, EventLoop}, - window::{Window, WindowBuilder}, -}; +use winit::dpi::LogicalSize; +use winit::event::*; +use winit::event_loop::{ControlFlow, EventLoop}; +use winit::window::{Window, WindowBuilder}; // Simple struct to hold the state of the renderer pub struct ActiveRenderState<'s> { diff --git a/examples/with_bevy/src/main.rs b/examples/with_bevy/src/main.rs index 9e4d8ae0c6..edc77337bf 100644 --- a/examples/with_bevy/src/main.rs +++ b/examples/with_bevy/src/main.rs @@ -9,18 +9,14 @@ use vello::kurbo::{Affine, Point, Rect, Stroke}; use vello::peniko::{Color, Fill, Gradient}; use vello::{Renderer, RendererOptions, Scene}; -use bevy::{ - prelude::*, - render::{ - extract_component::{ExtractComponent, ExtractComponentPlugin}, - render_asset::RenderAssets, - render_resource::{ - Extent3d, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages, - }, - renderer::{RenderDevice, RenderQueue}, - RenderApp, - }, +use bevy::prelude::*; +use bevy::render::extract_component::{ExtractComponent, ExtractComponentPlugin}; +use bevy::render::render_asset::RenderAssets; +use bevy::render::render_resource::{ + Extent3d, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages, }; +use bevy::render::renderer::{RenderDevice, RenderQueue}; +use bevy::render::RenderApp; #[derive(Resource)] struct VelloRenderer(SyncCell); diff --git a/examples/with_winit/src/hot_reload.rs b/examples/with_winit/src/hot_reload.rs index e65f920ddf..ba17897c00 100644 --- a/examples/with_winit/src/hot_reload.rs +++ b/examples/with_winit/src/hot_reload.rs @@ -1,10 +1,12 @@ // Copyright 2023 the Vello Authors // SPDX-License-Identifier: Apache-2.0 OR MIT -use std::{path::Path, time::Duration}; +use std::path::Path; +use std::time::Duration; use anyhow::Result; -use notify_debouncer_mini::{new_debouncer, notify::*, DebounceEventResult}; +use notify_debouncer_mini::notify::*; +use notify_debouncer_mini::{new_debouncer, DebounceEventResult}; pub(crate) fn hot_reload(mut f: impl FnMut() -> Option<()> + Send + 'static) -> Result { let mut debouncer = new_debouncer( diff --git a/examples/with_winit/src/lib.rs b/examples/with_winit/src/lib.rs index a4174a17c3..3f0f0c7652 100644 --- a/examples/with_winit/src/lib.rs +++ b/examples/with_winit/src/lib.rs @@ -2,24 +2,19 @@ // SPDX-License-Identifier: Apache-2.0 OR MIT use instant::Instant; +use std::collections::HashSet; use std::num::NonZeroUsize; -use std::{collections::HashSet, sync::Arc}; +use std::sync::Arc; use clap::{CommandFactory, Parser}; use scenes::{ImageCache, SceneParams, SceneSet, SimpleText}; +use vello::kurbo::{Affine, Vec2}; use vello::peniko::Color; -use vello::util::RenderSurface; -use vello::{ - kurbo::{Affine, Vec2}, - util::RenderContext, - AaConfig, Renderer, Scene, -}; -use vello::{BumpAllocators, RendererOptions}; - -use winit::{ - event_loop::{EventLoop, EventLoopBuilder}, - window::Window, -}; +use vello::util::{RenderContext, RenderSurface}; +use vello::{AaConfig, BumpAllocators, Renderer, RendererOptions, Scene}; + +use winit::event_loop::{EventLoop, EventLoopBuilder}; +use winit::window::Window; #[cfg(not(any(target_arch = "wasm32", target_os = "android")))] mod hot_reload; @@ -90,7 +85,9 @@ fn run( render_cx: RenderContext, #[cfg(target_arch = "wasm32")] render_state: RenderState, ) { - use winit::{event::*, event_loop::ControlFlow, keyboard::*}; + use winit::event::*; + use winit::event_loop::ControlFlow; + use winit::keyboard::*; let mut renderers: Vec> = vec![]; #[cfg(not(target_arch = "wasm32"))] let mut render_cx = render_cx; @@ -648,7 +645,8 @@ fn store_profiling( } fn create_window(event_loop: &winit::event_loop::EventLoopWindowTarget) -> Arc { - use winit::{dpi::LogicalSize, window::WindowBuilder}; + use winit::dpi::LogicalSize; + use winit::window::WindowBuilder; Arc::new( WindowBuilder::new() .with_inner_size(LogicalSize::new(1044, 800)) diff --git a/examples/with_winit/src/stats.rs b/examples/with_winit/src/stats.rs index 8fa14df8b0..6149512cf1 100644 --- a/examples/with_winit/src/stats.rs +++ b/examples/with_winit/src/stats.rs @@ -3,11 +3,9 @@ use scenes::SimpleText; use std::collections::VecDeque; -use vello::{ - kurbo::{Affine, PathEl, Rect, Stroke}, - peniko::{Brush, Color, Fill}, - AaConfig, BumpAllocators, Scene, -}; +use vello::kurbo::{Affine, PathEl, Rect, Stroke}; +use vello::peniko::{Brush, Color, Fill}; +use vello::{AaConfig, BumpAllocators, Scene}; const SLIDING_WINDOW_SIZE: usize = 100; diff --git a/src/cpu_dispatch.rs b/src/cpu_dispatch.rs index b0f48df4e6..3a555422bf 100644 --- a/src/cpu_dispatch.rs +++ b/src/cpu_dispatch.rs @@ -6,10 +6,8 @@ //! Note that while this CPU implementation is useful for testing and debugging, //! a full CPU fallback for targets without wgpu hasn't been implemented yet. -use std::{ - cell::{Ref, RefCell, RefMut}, - ops::{Deref, DerefMut}, -}; +use std::cell::{Ref, RefCell, RefMut}; +use std::ops::{Deref, DerefMut}; use bytemuck::Pod; diff --git a/src/cpu_shader/draw_leaf.rs b/src/cpu_shader/draw_leaf.rs index 6e940e878d..df86f6c3b3 100644 --- a/src/cpu_shader/draw_leaf.rs +++ b/src/cpu_shader/draw_leaf.rs @@ -5,8 +5,8 @@ use vello_encoding::{Clip, ConfigUniform, DrawMonoid, DrawTag, Monoid, PathBbox} use crate::cpu_dispatch::CpuBinding; +use super::util::{read_draw_tag_from_scene, Transform, Vec2}; use super::{ - util::{read_draw_tag_from_scene, Transform, Vec2}, RAD_GRAD_KIND_CIRCULAR, RAD_GRAD_KIND_CONE, RAD_GRAD_KIND_FOCAL_ON_CIRCLE, RAD_GRAD_KIND_STRIP, RAD_GRAD_SWAPPED, }; diff --git a/src/cpu_shader/flatten.rs b/src/cpu_shader/flatten.rs index 34a616b6c1..ba5b3354f4 100644 --- a/src/cpu_shader/flatten.rs +++ b/src/cpu_shader/flatten.rs @@ -4,9 +4,10 @@ use crate::cpu_dispatch::CpuBinding; use super::util::{Transform, Vec2, ROBUST_EPSILON}; +use vello_encoding::math::f16_to_f32; use vello_encoding::{ - math::f16_to_f32, BumpAllocators, ConfigUniform, LineSoup, Monoid, PathBbox, PathMonoid, - PathTag, Style, DRAW_INFO_FLAGS_FILL_RULE_BIT, + BumpAllocators, ConfigUniform, LineSoup, Monoid, PathBbox, PathMonoid, PathTag, Style, + DRAW_INFO_FLAGS_FILL_RULE_BIT, }; fn to_minus_one_quarter(x: f32) -> f32 { diff --git a/src/cpu_shader/path_tiling.rs b/src/cpu_shader/path_tiling.rs index d512b36e0a..ee01822adc 100644 --- a/src/cpu_shader/path_tiling.rs +++ b/src/cpu_shader/path_tiling.rs @@ -3,10 +3,8 @@ use vello_encoding::{BumpAllocators, LineSoup, Path, PathSegment, SegmentCount, Tile}; -use crate::{ - cpu_dispatch::CpuBinding, - cpu_shader::util::{ONE_MINUS_ULP, ROBUST_EPSILON}, -}; +use crate::cpu_dispatch::CpuBinding; +use crate::cpu_shader::util::{ONE_MINUS_ULP, ROBUST_EPSILON}; use super::util::{span, Vec2}; diff --git a/src/glyph.rs b/src/glyph.rs index 022d1bebb0..8d8a3627f7 100644 --- a/src/glyph.rs +++ b/src/glyph.rs @@ -4,22 +4,19 @@ //! Support for glyph rendering. use crate::scene::Scene; -use { - peniko::kurbo::Affine, - peniko::{Brush, Color, Fill, Style}, - skrifa::{ - instance::{NormalizedCoord, Size}, - outline::OutlinePen, - raw::FontRef, - setting::Setting, - GlyphId, OutlineGlyphCollection, - }, - vello_encoding::Encoding, -}; +use peniko::kurbo::Affine; +use peniko::{Brush, Color, Fill, Style}; +use skrifa::instance::{NormalizedCoord, Size}; +use skrifa::outline::OutlinePen; +use skrifa::raw::FontRef; +use skrifa::setting::Setting; +use skrifa::{GlyphId, OutlineGlyphCollection}; +use vello_encoding::Encoding; use peniko::kurbo::Shape; pub use skrifa; -use skrifa::{outline::DrawSettings, MetadataProvider}; +use skrifa::outline::DrawSettings; +use skrifa::MetadataProvider; pub use vello_encoding::Glyph; /// General context for creating scene fragments for glyph outlines. diff --git a/src/recording.rs b/src/recording.rs index 43b11df1e2..4d2dea6166 100644 --- a/src/recording.rs +++ b/src/recording.rs @@ -1,10 +1,8 @@ // Copyright 2022 the Vello Authors // SPDX-License-Identifier: Apache-2.0 OR MIT -use std::{ - num::NonZeroU64, - sync::atomic::{AtomicU64, Ordering}, -}; +use std::num::NonZeroU64; +use std::sync::atomic::{AtomicU64, Ordering}; #[derive(Clone, Copy, PartialEq, Eq, Hash, Default)] pub struct ShaderId(pub usize); diff --git a/src/render.rs b/src/render.rs index 264b4c7cb7..264b241d01 100644 --- a/src/render.rs +++ b/src/render.rs @@ -3,11 +3,9 @@ //! Take an encoded scene and create a graph to render it -use crate::{ - recording::{BufferProxy, ImageFormat, ImageProxy, Recording, ResourceProxy}, - shaders::FullShaders, - AaConfig, RenderParams, -}; +use crate::recording::{BufferProxy, ImageFormat, ImageProxy, Recording, ResourceProxy}; +use crate::shaders::FullShaders; +use crate::{AaConfig, RenderParams}; #[cfg(feature = "wgpu")] use crate::Scene; diff --git a/src/shaders/preprocess.rs b/src/shaders/preprocess.rs index 9f34c2e9a5..f392e3af2e 100644 --- a/src/shaders/preprocess.rs +++ b/src/shaders/preprocess.rs @@ -4,7 +4,9 @@ // TODO (#467) - Remove this file and use vello_shaders crate instead, // then update ARCHITECTURE.md. -use std::{collections::HashMap, fs, path::Path}; +use std::collections::HashMap; +use std::fs; +use std::path::Path; #[cfg(feature = "wgpu")] use std::{collections::HashSet, vec}; diff --git a/src/wgpu_engine.rs b/src/wgpu_engine.rs index 0c8ff00435..3d46498758 100644 --- a/src/wgpu_engine.rs +++ b/src/wgpu_engine.rs @@ -1,11 +1,10 @@ // Copyright 2023 the Vello Authors // SPDX-License-Identifier: Apache-2.0 OR MIT -use std::{ - borrow::Cow, - cell::RefCell, - collections::{hash_map::Entry, HashMap, HashSet}, -}; +use std::borrow::Cow; +use std::cell::RefCell; +use std::collections::hash_map::Entry; +use std::collections::{HashMap, HashSet}; use wgpu::{ BindGroup, BindGroupLayout, Buffer, BufferUsages, CommandEncoder, CommandEncoderDescriptor, @@ -13,9 +12,10 @@ use wgpu::{ TextureViewDimension, }; +use crate::cpu_dispatch::CpuBinding; +use crate::recording::BindType; use crate::{ - cpu_dispatch::CpuBinding, recording::BindType, BufferProxy, Command, Error, ImageProxy, - Recording, ResourceId, ResourceProxy, ShaderId, + BufferProxy, Command, Error, ImageProxy, Recording, ResourceId, ResourceProxy, ShaderId, }; #[cfg(not(target_arch = "wasm32"))] From e8b9b38c8c28909537ca341617c27aa909363eb0 Mon Sep 17 00:00:00 2001 From: "Spencer C. Imbleau" Date: Sat, 9 Mar 2024 11:02:28 -0500 Subject: [PATCH 3/4] docs: leave a TODO for `imports_granularity` --- rustfmt.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/rustfmt.toml b/rustfmt.toml index a18b909692..ce1f14b039 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,3 +1,4 @@ max_width = 100 use_field_init_shorthand = true newline_style = "Unix" +# TODO: imports_granularity = "Module" - Wait for this to be stable. From 1d12b29e592229b620064864b2cb11c54b982da4 Mon Sep 17 00:00:00 2001 From: "Spencer C. Imbleau" Date: Wed, 13 Mar 2024 20:03:21 -0400 Subject: [PATCH 4/4] Update rustfmt.toml Co-authored-by: Daniel McNab <36049421+DJMcNab@users.noreply.github.com> --- rustfmt.toml | 1 - 1 file changed, 1 deletion(-) diff --git a/rustfmt.toml b/rustfmt.toml index ce1f14b039..dcd7c771df 100644 --- a/rustfmt.toml +++ b/rustfmt.toml @@ -1,4 +1,3 @@ -max_width = 100 use_field_init_shorthand = true newline_style = "Unix" # TODO: imports_granularity = "Module" - Wait for this to be stable.