Skip to content

Commit

Permalink
use borrowed data for 💨 (i.e., speed)
Browse files Browse the repository at this point in the history
  • Loading branch information
najmiter committed Dec 15, 2024
1 parent e2a0147 commit 244ab15
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ pub fn chittify(source: &str) -> String {
"span",
styles.get(&tokens.class).unwrap_or(&"".to_string()),
&content,
get_classes(tokens, &content),
&get_classes(tokens, &content),
);
wrapper.push(span);
}
let line_content = wrapper.join("\n");
let wrapper_div =
create_element("div", "display: flex;", &line_content, "line".to_string());
create_element("div", "display: flex;", &line_content, &"line".to_string());
styled_html.push(wrapper_div);
}

create_element(
"div",
"display: grid;",
&styled_html.join("\n"),
"main-wrapper".to_string(),
&"main-wrapper".to_string(),
)
}

Expand Down
2 changes: 1 addition & 1 deletion src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::char;
use crate::contants::asm_data;
use crate::contants::Tokens;

pub fn create_element(name: &str, style: &str, content: &String, class: String) -> String {
pub fn create_element(name: &str, style: &str, content: &String, class: &String) -> String {
format!(
"<{} style='{}' class='{}'>{}</{}>",
name, style, class, content, name
Expand Down

0 comments on commit 244ab15

Please sign in to comment.