Skip to content

Commit 730a3f3

Browse files
authored
fix: cargo fmt (#158)
Use new fmt rules
1 parent 735940e commit 730a3f3

35 files changed

+148
-109
lines changed

examples/drag_n_drop/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
use std::{ffi::OsStr, task::Poll};
2+
13
use bevy::{
24
asset::{AssetMetaCheck, embedded_asset},
35
color::palettes::css::RED,
46
prelude::*,
57
};
68
use bevy_async_task::TaskRunner;
79
use bevy_vello::{VelloPlugin, prelude::*};
8-
use std::{ffi::OsStr, task::Poll};
910

1011
const NORMAL_BUTTON: Color = Color::srgb(0.15, 0.15, 0.15);
1112
const HOVERED_BUTTON: Color = Color::srgb(0.25, 0.25, 0.25);

examples/lottie_player/src/ui.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
use std::time::Duration;
2+
13
use bevy::prelude::*;
24
use bevy_egui::{
35
EguiContexts,
46
egui::{self, Color32},
57
};
68
use bevy_vello::prelude::*;
7-
use std::time::Duration;
89

910
#[expect(clippy::type_complexity)]
1011
pub fn controls_ui(

examples/render_layers/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//! Shows how to use render layers.
22
3+
use std::ops::DerefMut;
4+
35
use bevy::{color::palettes::css, prelude::*, render::view::RenderLayers};
46
use bevy_vello::{VelloPlugin, prelude::*};
5-
use std::ops::DerefMut;
67

78
fn main() {
89
App::new()

examples/scene/src/main.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1+
use std::ops::DerefMut;
2+
13
use bevy::prelude::*;
24
use bevy_vello::{VelloPlugin, prelude::*};
3-
use std::ops::DerefMut;
45

56
fn main() {
67
App::new()

examples/scene_ui/src/main.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1-
use bevy::{color::palettes::css, prelude::*};
2-
use bevy_vello::{VelloPlugin, prelude::*};
31
use std::{
42
f64::consts::{FRAC_PI_4, SQRT_2},
53
ops::DerefMut,
64
};
75

6+
use bevy::{color::palettes::css, prelude::*};
7+
use bevy_vello::{VelloPlugin, prelude::*};
8+
89
fn main() {
910
App::new()
1011
.add_plugins(DefaultPlugins)

rustfmt.toml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
max_width = 100
2-
# TODO: comment_width = 100 - Wait for this to be stable
3-
# TODO: wrap_comments = true - Wait for this to be stable
42
use_field_init_shorthand = true
53
newline_style = "Unix"
6-
# TODO: imports_granularity = "Crate" - Wait for this to be stable.
4+
# TODO: Enable - Currently nightly only :(
5+
# group_imports = "StdExternalCrate"
6+
# wrap_comments = true
7+
# comment_width = 100
8+
# imports_granularity = "Crate"

src/diagnostics.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
use crate::render::{VelloEntityCountData, VelloFrameProfileData};
21
use bevy::{
32
diagnostic::{Diagnostic, DiagnosticPath, Diagnostics, RegisterDiagnostic},
43
prelude::*,
54
};
65

6+
use crate::render::{VelloEntityCountData, VelloFrameProfileData};
7+
78
/// Adds Vello entity counting diagnostics to an App.
89
#[derive(Default)]
910
pub struct VelloEntityCountDiagnosticsPlugin;

src/integrations/lottie/asset.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
use crate::prelude::*;
1+
use std::sync::Arc;
2+
23
use bevy::{
34
prelude::*,
45
reflect::TypePath,
56
render::view::{self, VisibilityClass},
67
};
7-
use std::sync::Arc;
8+
9+
use crate::prelude::*;
810

911
#[derive(Component, Default, Debug, Clone, Deref, DerefMut, PartialEq, Eq, Reflect)]
1012
#[require(

src/integrations/lottie/asset_loader.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
use super::asset::VelloLottie;
2-
use crate::integrations::{VectorLoaderError, lottie::load_lottie_from_bytes};
31
use bevy::{
42
asset::{AssetLoader, LoadContext, io::Reader},
53
prelude::*,
64
tasks::ConditionalSendFuture,
75
};
86

7+
use super::asset::VelloLottie;
8+
use crate::integrations::{VectorLoaderError, lottie::load_lottie_from_bytes};
9+
910
#[derive(Default)]
1011
pub struct VelloLottieLoader;
1112

src/integrations/lottie/lottie_player.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
use super::PlayerState;
21
use bevy::{platform::collections::HashMap, prelude::*};
32

3+
use super::PlayerState;
4+
45
/// A lottie player that allows runtime manipulation of Lottie animations.
56
///
67
/// Controls lottie playback and transitions with state machine support.

src/integrations/lottie/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,8 @@ mod player_transition;
3434
pub use player_transition::PlayerTransition;
3535

3636
mod theme;
37-
pub use theme::Theme;
38-
3937
use bevy::{prelude::*, render::view::VisibilityClass};
38+
pub use theme::Theme;
4039

4140
#[cfg(feature = "lottie")]
4241
#[derive(Bundle, Default)]
@@ -59,7 +58,8 @@ pub struct VelloLottieBundle {
5958
pub visibility_class: VisibilityClass,
6059
}
6160

62-
/// Describes how the asset is positioned relative to its [`Transform`]. It defaults to [`VelloAssetAnchor::Center`].
61+
/// Describes how the asset is positioned relative to its [`Transform`]. It defaults to
62+
/// [`VelloAssetAnchor::Center`].
6363
#[derive(Component, Default, Debug, Clone, Copy, PartialEq, Eq, Reflect)]
6464
#[reflect(Component)]
6565
pub enum VelloLottieAnchor {

src/integrations/lottie/parse.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
use std::sync::Arc;
2+
3+
use bevy::prelude::*;
4+
15
use super::asset::VelloLottie;
26
use crate::integrations::VectorLoaderError;
3-
use bevy::prelude::*;
4-
use std::sync::Arc;
57

68
/// Deserialize a Lottie file from bytes.
79
pub fn load_lottie_from_bytes(bytes: &[u8]) -> Result<VelloLottie, VectorLoaderError> {

src/integrations/lottie/playback_options.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//! Playback options for lottie files.
22
3-
use bevy::prelude::*;
43
use std::{ops::Range, time::Duration};
54

5+
use bevy::prelude::*;
6+
67
/// Playback options which adjust the playback of an asset.
78
///
89
/// You can add this component directly to a `VelloAssetBundle` entity to adjust

src/integrations/lottie/plugin.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1+
use bevy::{
2+
prelude::*,
3+
render::{Render, RenderApp, RenderSet},
4+
};
5+
16
use super::{
27
PlaybackOptions, VelloLottie, VelloLottieAnchor, asset::VelloLottieHandle,
38
asset_loader::VelloLottieLoader, render, systems,
49
};
510
use crate::render::{VelatoRenderer, extract::VelloExtractStep};
6-
use bevy::{
7-
prelude::*,
8-
render::{Render, RenderApp, RenderSet},
9-
};
1011

1112
pub struct LottieIntegrationPlugin;
1213

src/integrations/lottie/render.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
use bevy::{
2+
prelude::*,
3+
render::{
4+
Extract,
5+
camera::ExtractedCamera,
6+
sync_world::TemporaryRenderEntity,
7+
view::{ExtractedView, RenderLayers},
8+
},
9+
};
10+
use vello::kurbo::Affine;
11+
112
use super::{
213
Playhead, Theme, VelloLottieAnchor,
314
asset::{VelloLottie, VelloLottieHandle},
@@ -9,16 +20,6 @@ use crate::{
920
prepare::{PrepareRenderInstance, PreparedAffine, PreparedTransform},
1021
},
1122
};
12-
use bevy::{
13-
prelude::*,
14-
render::{
15-
Extract,
16-
camera::ExtractedCamera,
17-
sync_world::TemporaryRenderEntity,
18-
view::{ExtractedView, RenderLayers},
19-
},
20-
};
21-
use vello::kurbo::Affine;
2223

2324
#[derive(Component, Clone)]
2425
pub struct ExtractedLottieAsset {

src/integrations/lottie/systems.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
use std::time::Duration;
2+
3+
use bevy::{platform::time::Instant, prelude::*, window::PrimaryWindow};
4+
15
use super::{
26
LottiePlayer, PlayerTransition,
37
asset::{VelloLottie, VelloLottieHandle},
@@ -6,8 +10,6 @@ use crate::{
610
PlaybackDirection, PlaybackLoopBehavior, PlaybackOptions, Playhead,
711
integrations::lottie::PlaybackPlayMode, render::VelloView,
812
};
9-
use bevy::{platform::time::Instant, prelude::*, window::PrimaryWindow};
10-
use std::time::Duration;
1113

1214
/// Helper function to get the next smallest representable f64.
1315
/// For example, prev_f64(3.0) == 2.9999999999999996

src/integrations/svg/asset.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
use crate::prelude::*;
1+
use std::sync::Arc;
2+
23
use bevy::{
34
prelude::*,
45
reflect::TypePath,
56
render::view::{self, VisibilityClass},
67
};
7-
use std::sync::Arc;
8+
9+
use crate::prelude::*;
810

911
#[derive(Component, Default, Debug, Clone, Deref, DerefMut, PartialEq, Eq, Reflect)]
1012
#[require(VelloSvgAnchor, Transform, Visibility, VisibilityClass)]

src/integrations/svg/asset_loader.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
use super::asset::VelloSvg;
2-
use crate::integrations::{VectorLoaderError, svg::load_svg_from_bytes};
31
use bevy::{
42
asset::{AssetLoader, LoadContext, io::Reader},
53
prelude::*,
64
tasks::ConditionalSendFuture,
75
};
86

7+
use super::asset::VelloSvg;
8+
use crate::integrations::{VectorLoaderError, svg::load_svg_from_bytes};
9+
910
#[derive(Default)]
1011
pub struct VelloSvgLoader;
1112

src/integrations/svg/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ mod parse;
99
pub use parse::{load_svg_from_bytes, load_svg_from_str};
1010

1111
mod plugin;
12-
pub(crate) use plugin::SvgIntegrationPlugin;
13-
1412
use bevy::{prelude::*, render::view::VisibilityClass};
13+
pub(crate) use plugin::SvgIntegrationPlugin;
1514
#[derive(Bundle, Default)]
1615
pub struct VelloSvgBundle {
1716
/// Asset data to render
@@ -26,7 +25,8 @@ pub struct VelloSvgBundle {
2625
pub visibility_class: VisibilityClass,
2726
}
2827

29-
/// Describes how the asset is positioned relative to its [`Transform`]. It defaults to [`VelloAssetAnchor::Center`].
28+
/// Describes how the asset is positioned relative to its [`Transform`]. It defaults to
29+
/// [`VelloAssetAnchor::Center`].
3030
#[derive(Component, Default, Debug, Clone, Copy, PartialEq, Eq, Reflect)]
3131
#[reflect(Component)]
3232
pub enum VelloSvgAnchor {

src/integrations/svg/parse.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
use super::asset::VelloSvg;
2-
use crate::integrations::VectorLoaderError;
3-
use bevy::transform::components::Transform;
41
use std::sync::Arc;
2+
3+
use bevy::transform::components::Transform;
54
use vello_svg::usvg::{self};
65

6+
use super::asset::VelloSvg;
7+
use crate::integrations::VectorLoaderError;
8+
79
/// Deserialize an SVG file from bytes.
810
pub fn load_svg_from_bytes(bytes: &[u8]) -> Result<VelloSvg, VectorLoaderError> {
911
let svg_str = std::str::from_utf8(bytes)?;

src/integrations/svg/plugin.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
use super::{
2-
VelloSvg, VelloSvgAnchor, asset::VelloSvgHandle, asset_loader::VelloSvgLoader, render,
3-
};
4-
use crate::render::extract::VelloExtractStep;
51
use bevy::{
62
prelude::*,
73
render::{Render, RenderApp, RenderSet},
84
};
95

6+
use super::{
7+
VelloSvg, VelloSvgAnchor, asset::VelloSvgHandle, asset_loader::VelloSvgLoader, render,
8+
};
9+
use crate::render::extract::VelloExtractStep;
10+
1011
pub struct SvgIntegrationPlugin;
1112

1213
impl Plugin for SvgIntegrationPlugin {

src/integrations/svg/render.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
use bevy::{
2+
prelude::*,
3+
render::{
4+
Extract,
5+
camera::ExtractedCamera,
6+
sync_world::TemporaryRenderEntity,
7+
view::{ExtractedView, RenderLayers},
8+
},
9+
};
10+
use kurbo::Affine;
11+
112
use super::{
213
VelloSvgAnchor,
314
asset::{VelloSvg, VelloSvgHandle},
@@ -9,16 +20,6 @@ use crate::{
920
prepare::{PrepareRenderInstance, PreparedAffine, PreparedTransform},
1021
},
1122
};
12-
use bevy::{
13-
prelude::*,
14-
render::{
15-
Extract,
16-
camera::ExtractedCamera,
17-
sync_world::TemporaryRenderEntity,
18-
view::{ExtractedView, RenderLayers},
19-
},
20-
};
21-
use kurbo::Affine;
2223

2324
#[derive(Component, Clone)]
2425
pub struct ExtractedVelloSvg {

src/integrations/text/font.rs

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,22 @@
1-
use super::{
2-
VelloTextAnchor,
3-
context::LOCAL_FONT_CONTEXT,
4-
vello_text::{VelloFontAxes, VelloTextSection},
5-
};
6-
use crate::integrations::text::context::{LOCAL_LAYOUT_CONTEXT, get_global_font_context};
1+
use std::borrow::Cow;
2+
73
use bevy::{prelude::*, reflect::TypePath, render::render_asset::RenderAsset};
84
use parley::{
95
FontSettings, FontStyle, FontVariation, PositionedLayoutItem, RangedBuilder, StyleProperty,
106
};
11-
use std::borrow::Cow;
127
use vello::{
138
Scene,
149
kurbo::Affine,
1510
peniko::{Brush, Fill},
1611
};
1712

13+
use super::{
14+
VelloTextAnchor,
15+
context::LOCAL_FONT_CONTEXT,
16+
vello_text::{VelloFontAxes, VelloTextSection},
17+
};
18+
use crate::integrations::text::context::{LOCAL_LAYOUT_CONTEXT, get_global_font_context};
19+
1820
#[derive(Asset, TypePath, Debug, Clone)]
1921
pub struct VelloFont {
2022
/// Defaults to Bevy's bevy_text default font family name.

src/integrations/text/font_loader.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
use super::{context::get_global_font_context, font::VelloFont};
2-
use crate::{integrations::VectorLoaderError, integrations::text::context::LOCAL_FONT_CONTEXT};
31
use bevy::asset::{AssetLoader, LoadContext, io::Reader};
42

3+
use super::{context::get_global_font_context, font::VelloFont};
4+
use crate::integrations::{VectorLoaderError, text::context::LOCAL_FONT_CONTEXT};
5+
56
#[derive(Default)]
67
pub struct VelloFontLoader;
78

0 commit comments

Comments
 (0)