Skip to content

Commit

Permalink
Remove thiserror from bevy_sprite (#15763)
Browse files Browse the repository at this point in the history
# Objective

- Contributes to #15460

## Solution

- Removed `thiserror` from `bevy_sprite`
  • Loading branch information
bushrat011899 authored Oct 9, 2024
1 parent b50f2ec commit ecd04c1
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
6 changes: 5 additions & 1 deletion crates/bevy_sprite/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ bevy_derive = { path = "../bevy_derive", version = "0.15.0-dev" }
bytemuck = { version = "1", features = ["derive", "must_cast"] }
fixedbitset = "0.5"
guillotiere = "0.6.0"
thiserror = "1.0"
derive_more = { version = "1", default-features = false, features = [
"error",
"from",
"display",
] }
rectangle-pack = "0.4"
bitflags = "2.3"
radsort = "0.1"
Expand Down
9 changes: 2 additions & 7 deletions crates/bevy_sprite/src/mesh2d/material.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ use bevy_render::{
use bevy_transform::components::{GlobalTransform, Transform};
use bevy_utils::tracing::error;
use core::{hash::Hash, marker::PhantomData};
use derive_more::derive::From;

use crate::{
DrawMesh2d, Mesh2d, Mesh2dPipeline, Mesh2dPipelineKey, RenderMesh2dInstances,
Expand Down Expand Up @@ -209,7 +210,7 @@ pub trait Material2d: AsBindGroup + Asset + Clone + Sized {
/// commands.spawn(Mesh2d(meshes.add(Circle::new(50.0))));
/// }
/// ```
#[derive(Component, Clone, Debug, Deref, DerefMut, Reflect, PartialEq, Eq)]
#[derive(Component, Clone, Debug, Deref, DerefMut, Reflect, PartialEq, Eq, From)]
#[reflect(Component, Default)]
#[require(HasMaterial2d)]
pub struct MeshMaterial2d<M: Material2d>(pub Handle<M>);
Expand All @@ -220,12 +221,6 @@ impl<M: Material2d> Default for MeshMaterial2d<M> {
}
}

impl<M: Material2d> From<Handle<M>> for MeshMaterial2d<M> {
fn from(handle: Handle<M>) -> Self {
Self(handle)
}
}

impl<M: Material2d> From<MeshMaterial2d<M>> for AssetId<M> {
fn from(material: MeshMaterial2d<M>) -> Self {
material.id()
Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_sprite/src/texture_atlas_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,19 @@ use bevy_utils::{
tracing::{debug, error, warn},
HashMap,
};
use derive_more::derive::{Display, Error};
use rectangle_pack::{
contains_smallest_box, pack_rects, volume_heuristic, GroupedRectsToPlace, PackedLocation,
RectToInsert, TargetBin,
};
use thiserror::Error;

use crate::{TextureAtlasLayout, TextureAtlasSources};

#[derive(Debug, Error)]
#[derive(Debug, Error, Display)]
pub enum TextureAtlasBuilderError {
#[error("could not pack textures into an atlas within the given bounds")]
#[display("could not pack textures into an atlas within the given bounds")]
NotEnoughSpace,
#[error("added a texture with the wrong format in an atlas")]
#[display("added a texture with the wrong format in an atlas")]
WrongFormat,
}

Expand Down

0 comments on commit ecd04c1

Please sign in to comment.