Skip to content

Commit ecd04c1

Browse files
Remove thiserror from bevy_sprite (#15763)
# Objective - Contributes to #15460 ## Solution - Removed `thiserror` from `bevy_sprite`
1 parent b50f2ec commit ecd04c1

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

crates/bevy_sprite/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ bevy_derive = { path = "../bevy_derive", version = "0.15.0-dev" }
3737
bytemuck = { version = "1", features = ["derive", "must_cast"] }
3838
fixedbitset = "0.5"
3939
guillotiere = "0.6.0"
40-
thiserror = "1.0"
40+
derive_more = { version = "1", default-features = false, features = [
41+
"error",
42+
"from",
43+
"display",
44+
] }
4145
rectangle-pack = "0.4"
4246
bitflags = "2.3"
4347
radsort = "0.1"

crates/bevy_sprite/src/mesh2d/material.rs

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ use bevy_render::{
3636
use bevy_transform::components::{GlobalTransform, Transform};
3737
use bevy_utils::tracing::error;
3838
use core::{hash::Hash, marker::PhantomData};
39+
use derive_more::derive::From;
3940

4041
use crate::{
4142
DrawMesh2d, Mesh2d, Mesh2dPipeline, Mesh2dPipelineKey, RenderMesh2dInstances,
@@ -209,7 +210,7 @@ pub trait Material2d: AsBindGroup + Asset + Clone + Sized {
209210
/// commands.spawn(Mesh2d(meshes.add(Circle::new(50.0))));
210211
/// }
211212
/// ```
212-
#[derive(Component, Clone, Debug, Deref, DerefMut, Reflect, PartialEq, Eq)]
213+
#[derive(Component, Clone, Debug, Deref, DerefMut, Reflect, PartialEq, Eq, From)]
213214
#[reflect(Component, Default)]
214215
#[require(HasMaterial2d)]
215216
pub struct MeshMaterial2d<M: Material2d>(pub Handle<M>);
@@ -220,12 +221,6 @@ impl<M: Material2d> Default for MeshMaterial2d<M> {
220221
}
221222
}
222223

223-
impl<M: Material2d> From<Handle<M>> for MeshMaterial2d<M> {
224-
fn from(handle: Handle<M>) -> Self {
225-
Self(handle)
226-
}
227-
}
228-
229224
impl<M: Material2d> From<MeshMaterial2d<M>> for AssetId<M> {
230225
fn from(material: MeshMaterial2d<M>) -> Self {
231226
material.id()

crates/bevy_sprite/src/texture_atlas_builder.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,19 @@ use bevy_utils::{
99
tracing::{debug, error, warn},
1010
HashMap,
1111
};
12+
use derive_more::derive::{Display, Error};
1213
use rectangle_pack::{
1314
contains_smallest_box, pack_rects, volume_heuristic, GroupedRectsToPlace, PackedLocation,
1415
RectToInsert, TargetBin,
1516
};
16-
use thiserror::Error;
1717

1818
use crate::{TextureAtlasLayout, TextureAtlasSources};
1919

20-
#[derive(Debug, Error)]
20+
#[derive(Debug, Error, Display)]
2121
pub enum TextureAtlasBuilderError {
22-
#[error("could not pack textures into an atlas within the given bounds")]
22+
#[display("could not pack textures into an atlas within the given bounds")]
2323
NotEnoughSpace,
24-
#[error("added a texture with the wrong format in an atlas")]
24+
#[display("added a texture with the wrong format in an atlas")]
2525
WrongFormat,
2626
}
2727

0 commit comments

Comments
 (0)