summaryrefslogtreecommitdiffstats
path: root/font/src/ft
diff options
context:
space:
mode:
authorsterlingjensen <5555776+sterlingjensen@users.noreply.github.com>2020-01-02 18:17:22 -0600
committerChristian Duerr <contact@christianduerr.com>2020-01-03 00:17:22 +0000
commit05df4f4dbabd82bc71cea6b81ee9383a55b32088 (patch)
tree839acbe3cde075efbd06449e65521b58b093a18d /font/src/ft
parentd774c7f3a3466b6d7dbcce4c149d74c041036c9f (diff)
Replace deprecated Error methods
Diffstat (limited to 'font/src/ft')
-rw-r--r--font/src/ft/mod.rs31
1 files changed, 11 insertions, 20 deletions
diff --git a/font/src/ft/mod.rs b/font/src/ft/mod.rs
index 431a5004..206d6042 100644
--- a/font/src/ft/mod.rs
+++ b/font/src/ft/mod.rs
@@ -15,7 +15,7 @@
//! Rasterization powered by FreeType and FontConfig
use std::cmp::{min, Ordering};
use std::collections::HashMap;
-use std::fmt;
+use std::fmt::{self, Display, Formatter};
use std::path::PathBuf;
use freetype::freetype_sys;
@@ -46,7 +46,7 @@ struct Face {
}
impl fmt::Debug for Face {
- fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
+ fn fmt(&self, f: &mut Formatter) -> fmt::Result {
f.debug_struct("Face")
.field("ft_face", &self.ft_face)
.field("key", &self.key)
@@ -668,32 +668,23 @@ pub enum Error {
}
impl std::error::Error for Error {
- fn cause(&self) -> Option<&dyn std::error::Error> {
- match *self {
- Error::FreeType(ref err) => Some(err),
+ fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
+ match self {
+ Error::FreeType(err) => err.source(),
_ => None,
}
}
-
- fn description(&self) -> &str {
- match *self {
- Error::FreeType(ref err) => err.description(),
- Error::MissingFont(ref _desc) => "Couldn't find the requested font",
- Error::FontNotLoaded => "Tried to operate on font that hasn't been loaded",
- Error::MissingSizeMetrics => "Tried to get size metrics from a face without a size",
- }
- }
}
-impl std::fmt::Display for Error {
- fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result {
- match *self {
- Error::FreeType(ref err) => err.fmt(f),
- Error::MissingFont(ref desc) => write!(
+impl Display for Error {
+ fn fmt(&self, f: &mut Formatter) -> fmt::Result {
+ match self {
+ Error::FreeType(err) => err.fmt(f),
+ Error::MissingFont(err) => write!(
f,
"Couldn't find a font with {}\n\tPlease check the font config in your \
alacritty.yml.",
- desc
+ err
),
Error::FontNotLoaded => f.write_str("Tried to use a font that hasn't been loaded"),
Error::MissingSizeMetrics => {