Skip to content

Commit

Permalink
Generalize page title logic
Browse files Browse the repository at this point in the history
  • Loading branch information
lindhe committed Aug 13, 2023
1 parent fba11df commit 8f09e4a
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,13 @@ fn get_webicon(family: &str, id: &str, vendor: Option<String>) -> (ContentType,
let id = token::normalize_id(id, family);

let metadata = metadata::get_metadata(DEFAULT_CONFIG_FILE_PATH, family, &vendor);
let emoji = token::get_emoji_from_id(&id).as_str();
let title = format!("{} ({})", emoji, id);
let title = match family {
metadata::WebiconFamily::Emojis => {
let emoji = token::get_emoji_from_id(&id).as_str();
format!("{} ({})", emoji, id)
}
_ => format!("{}", id),

Check warning on line 33 in src/main.rs

View workflow job for this annotation

GitHub Actions / Clippy

warning: useless use of `format!` --> src/main.rs:33:14 | 33 | _ => format!("{}", id), | ^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `id.to_string()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format = note: `#[warn(clippy::useless_format)]` on by default

Check warning on line 33 in src/main.rs

View workflow job for this annotation

GitHub Actions / Clippy

warning: useless use of `format!` --> src/main.rs:33:14 | 33 | _ => format!("{}", id), | ^^^^^^^^^^^^^^^^^ help: consider using `.to_string()`: `id.to_string()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#useless_format = note: `#[warn(clippy::useless_format)]` on by default
};
let html = webicons::html::make_html(&metadata, &title);

(ContentType::HTML, html.to_string())
Expand Down

0 comments on commit 8f09e4a

Please sign in to comment.