1
1
mirror of https://github.com/wez/wezterm.git synced 2024-12-23 13:21:38 +03:00

gdi.rs: Avoid non-idiomatic iterations over Option, they cause warnings

This commit is contained in:
Pavel Roskin 2023-03-05 09:35:50 -08:00 committed by Wez Furlong
parent 2d05f8f1f2
commit a7cc87f30f

View File

@ -79,11 +79,10 @@ fn extract_font_data(
parse_and_collect_font_info(&source, &mut font_info, FontOrigin::Gdi)?;
let matches = ParsedFont::best_match(attr, pixel_size, font_info);
for m in matches {
return Ok(m);
match matches {
Some(m) => Ok(m),
None => anyhow::bail!("No font matching {:?} in {:?}", attr, source),
}
anyhow::bail!("No font matching {:?} in {:?}", attr, source);
}
/// Convert a rust string to a windows wide string
@ -157,11 +156,10 @@ pub fn parse_log_font(log_font: &LOGFONTW, hdc: HDC) -> anyhow::Result<(ParsedFo
parse_and_collect_font_info(&source, &mut font_info, FontOrigin::Gdi)?;
let matches = ParsedFont::best_match(&attr, pixel_size, font_info);
for m in matches {
return Ok((m, point_size));
match matches {
Some(m) => Ok((m, point_size)),
None => anyhow::bail!("No font matching {:?} in {:?}", attr, source),
}
anyhow::bail!("No font matching {:?} in {:?}", attr, source);
}
}