Skip to content

Commit 8fd3d54

Browse files
Remove thiserror from bevy_text (#15762)
# Objective - Contributes to #15460 ## Solution - Removed `thiserror` from `bevy_text`
1 parent 8718adc commit 8fd3d54

File tree

3 files changed

+16
-12
lines changed

3 files changed

+16
-12
lines changed

crates/bevy_text/Cargo.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,11 @@ bevy_utils = { path = "../bevy_utils", version = "0.15.0-dev" }
3030

3131
# other
3232
cosmic-text = { version = "0.12", features = ["shape-run-cache"] }
33-
thiserror = "1.0"
33+
derive_more = { version = "1", default-features = false, features = [
34+
"error",
35+
"from",
36+
"display",
37+
] }
3438
serde = { version = "1", features = ["derive"] }
3539
unicode-bidi = "0.3.13"
3640
sys-locale = "0.3.0"

crates/bevy_text/src/error.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
use cosmic_text::CacheKey;
2-
use thiserror::Error;
2+
use derive_more::derive::{Display, Error};
33

4-
#[derive(Debug, PartialEq, Eq, Error)]
4+
#[derive(Debug, PartialEq, Eq, Error, Display)]
55
/// Errors related to the textsystem
66
pub enum TextError {
77
/// Font was not found, this could be that the font has not yet been loaded, or
88
/// that the font failed to load for some other reason
9-
#[error("font not found")]
9+
#[display("font not found")]
1010
NoSuchFont,
1111
/// Failed to add glyph to a newly created atlas for some reason
12-
#[error("failed to add glyph to newly-created atlas {0:?}")]
12+
#[display("failed to add glyph to newly-created atlas {_0:?}")]
13+
#[error(ignore)]
1314
FailedToAddGlyph(u16),
1415
/// Failed to get scaled glyph image for cache key
15-
#[error("failed to get scaled glyph image for cache key: {0:?}")]
16+
#[display("failed to get scaled glyph image for cache key: {_0:?}")]
17+
#[error(ignore)]
1618
FailedToGetGlyphImage(CacheKey),
1719
}

crates/bevy_text/src/font_loader.rs

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
use crate::Font;
22
use bevy_asset::{io::Reader, AssetLoader, LoadContext};
3-
use thiserror::Error;
3+
use derive_more::derive::{Display, Error, From};
44

55
#[derive(Default)]
66
/// An [`AssetLoader`] for [`Font`]s, for use by the [`AssetServer`](bevy_asset::AssetServer)
77
pub struct FontLoader;
88

99
/// Possible errors that can be produced by [`FontLoader`]
1010
#[non_exhaustive]
11-
#[derive(Debug, Error)]
11+
#[derive(Debug, Error, Display, From)]
1212
pub enum FontLoaderError {
1313
/// The contents that could not be parsed
14-
#[error(transparent)]
15-
Content(#[from] cosmic_text::ttf_parser::FaceParsingError),
14+
Content(cosmic_text::ttf_parser::FaceParsingError),
1615
/// An [IO](std::io) Error
17-
#[error(transparent)]
18-
Io(#[from] std::io::Error),
16+
Io(std::io::Error),
1917
}
2018

2119
impl AssetLoader for FontLoader {

0 commit comments

Comments
 (0)