clippy: Fix remaining warnings in gfx for MacOS (#31669)

This commit is contained in:
Martin Robinson 2024-03-15 13:14:36 +01:00 committed by GitHub
parent cb3ae70340
commit a8791ddcbc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 66 additions and 69 deletions

View file

@ -181,16 +181,15 @@ impl FontTemplate {
})
}
fn instantiate(&mut self, font_context: &FontContextHandle) -> Result<(), ()> {
fn instantiate(&mut self, font_context: &FontContextHandle) -> Result<(), &'static str> {
if !self.is_valid {
return Err(());
return Err("Invalid font template");
}
let data = self.data().map_err(|_| ())?;
let handle: Result<FontHandle, ()> =
FontHandleMethods::new_from_template(font_context, data, None);
let data = self.data().map_err(|_| "Could not get FontTemplate data")?;
let handle = FontHandleMethods::new_from_template(font_context, data, None);
self.is_valid = handle.is_ok();
let handle = handle?;
let handle: FontHandle = handle?;
self.descriptor = Some(FontTemplateDescriptor::new(
handle.boldness(),
handle.stretchiness(),