Skip to content

Commit

Permalink
refactor: cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
simbleau committed Sep 10, 2023
1 parent aba7147 commit 1977b86
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 9 deletions.
10 changes: 7 additions & 3 deletions src/debug.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ fn draw_viewbox(
query_cam: Query<(&Camera, &GlobalTransform, &OrthographicProjection), With<Camera2d>>,
mut gizmos: Gizmos,
) {
let Ok((camera, view, projection)) = query_cam.get_single() else { return };
let Ok((camera, view, projection)) = query_cam.get_single() else {
return;
};

const RED_X_SIZE: f32 = 8.0;

Expand Down Expand Up @@ -69,8 +71,10 @@ fn draw_viewbox(
.iter()
.map(|&v| camera.viewport_to_world_2d(view, v))
.collect::<Vec<Option<Vec2>>>()
.as_slice() else
{ continue; };
.as_slice()
else {
continue;
};

gizmos.line_2d(min, x_axis, Color::WHITE);
gizmos.line_2d(min, y_axis, Color::WHITE);
Expand Down
4 changes: 3 additions & 1 deletion src/renderer/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ pub struct VelloRenderPlugin;

impl Plugin for VelloRenderPlugin {
fn build(&self, app: &mut App) {
let Ok(render_app) = app.get_sub_app_mut(RenderApp) else { return };
let Ok(render_app) = app.get_sub_app_mut(RenderApp) else {
return;
};
render_app.insert_resource(LottieRenderer(vellottie::Renderer::new()));
render_app.insert_resource(ExtractedPixelScale(1.0));

Expand Down
11 changes: 8 additions & 3 deletions src/renderer/prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ pub fn prepare_vector_composition_edits(mut render_vectors: Query<&mut Extracted
continue 'layers;
};
'shapegroups: for (shape_index, shape) in shapes.iter_mut().enumerate() {
let vellottie::runtime::model::Shape::Group(ref mut shapes, _transform) = shape else {
let vellottie::runtime::model::Shape::Group(ref mut shapes, _transform) = shape
else {
continue 'shapegroups;
};
'shapes: for shape in shapes.iter_mut() {
Expand Down Expand Up @@ -70,7 +71,9 @@ pub fn prepare_vector_affines(
render_vector_assets: Res<RenderAssets<VelloVector>>,
pixel_scale: Res<ExtractedPixelScale>,
) {
let Ok((camera, view)) = camera.get_single() else { return };
let Ok((camera, view)) = camera.get_single() else {
return;
};
let size_pixels: UVec2 = camera.physical_viewport_size.unwrap();
let (pixels_x, pixels_y) = (size_pixels.x as f32, size_pixels.y as f32);
for (entity, render_vector) in render_vectors.iter_mut() {
Expand Down Expand Up @@ -151,7 +154,9 @@ pub fn prepare_text_affines(
render_texts: Query<(Entity, &ExtractedRenderText)>,
pixel_scale: Res<ExtractedPixelScale>,
) {
let Ok((camera, view)) = camera.get_single() else { return };
let Ok((camera, view)) = camera.get_single() else {
return;
};
let size_pixels: UVec2 = camera.physical_viewport_size.unwrap();
let (pixels_x, pixels_y) = (size_pixels.x as f32, size_pixels.y as f32);
for (entity, render_text) in render_texts.iter() {
Expand Down
8 changes: 6 additions & 2 deletions src/rendertarget.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ pub fn resize_rendertargets(
mut target_materials: ResMut<Assets<SSTargetMaterial>>,
windows: Query<&Window>,
) {
let Ok(window) = windows.get_single() else { return };
let Ok(window) = windows.get_single() else {
return;
};
if window_resize_events.iter().last().is_some() {
let size = Extent3d {
width: window.resolution.physical_width(),
Expand Down Expand Up @@ -115,7 +117,9 @@ pub fn setup_ss_rendertarget(
// query_vectors: Query<Entity, Added<Handle<VelloVector>>>,
mut render_target_mesh_handle: Local<Option<Handle<Mesh>>>,
) {
let Ok(window) = windows.get_single() else { return };
let Ok(window) = windows.get_single() else {
return;
};

let mesh_handle = render_target_mesh_handle.get_or_insert_with(|| {
let mut rendertarget_quad = Mesh::new(PrimitiveTopology::TriangleList);
Expand Down

0 comments on commit 1977b86

Please sign in to comment.