Skip to content

Commit

Permalink
Accept arg to or_else closures
Browse files Browse the repository at this point in the history
  • Loading branch information
uncenter committed Nov 21, 2024
1 parent 26a2d3a commit 905cce2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/renderer/html_handlebars/hbs_renderer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,9 @@ fn convert_fontawesome(html: &str) -> String {

if icon.is_empty() {
text.to_owned()
} else if let Ok(svg) = fa::svg(type_, &icon).or_else(|| fa::svg(fa::Type::Brands, &icon)) {
} else if let Ok(svg) =
fa::svg(type_, &icon).or_else(|_| fa::svg(fa::Type::Brands, &icon))
{
format!(
r#"<span{before}class="fa-svg{other_classes}"{after}>{svg}</span>"#,
before = before,
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/html_handlebars/helpers/fontawesome.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub fn fa_helper(
}
out.write(
fa::svg(type_, name)
.or_else(|| fa::svg(fa::Type::Brands, name))
.or_else(|_| fa::svg(fa::Type::Brands, name))
.map_err(|_| RenderErrorReason::Other(format!("Missing font {}", name)))?,
)?;
out.write("</span>")?;
Expand Down

0 comments on commit 905cce2

Please sign in to comment.