chore(native): run cargo fmt

Signed-off-by: SphericalKat <amolele@gmail.com>
This commit is contained in:
sphericalkat committed 2021-08-17 03:24:30 +05:30
1 parent 92146cd3dc
commit 816332bdd6
1 file changed
+15 -11
+15 -11
View File
@@ -1,4 +1,8 @@
use syntect::{html::{ClassStyle, ClassedHTMLGenerator}, parsing::SyntaxSet, util::LinesWithEndings};
use syntect::{
html::{ClassStyle, ClassedHTMLGenerator},
parsing::SyntaxSet,
util::LinesWithEndings,
};
#[rustler::nif]
fn add(a: i64, b: i64) -> i64 {
@@ -7,20 +11,20 @@ fn add(a: i64, b: i64) -> i64 {
#[rustler::nif]
pub fn highlight_text(text: String, lang: String) -> String {
let syntax_set = SyntaxSet::load_defaults_newlines();
let syntax_set = SyntaxSet::load_defaults_newlines();
let syntax = syntax_set
.find_syntax_by_extension(&lang)
.unwrap_or(syntax_set.find_syntax_plain_text());
let syntax = syntax_set
.find_syntax_by_extension(&lang)
.unwrap_or(syntax_set.find_syntax_plain_text());
let mut rs_html_generator =
ClassedHTMLGenerator::new_with_class_style(syntax, &syntax_set, ClassStyle::Spaced);
let mut rs_html_generator =
ClassedHTMLGenerator::new_with_class_style(syntax, &syntax_set, ClassStyle::Spaced);
for line in LinesWithEndings::from(&text) {
rs_html_generator.parse_html_for_line_which_includes_newline(&line)
}
for line in LinesWithEndings::from(&text) {
rs_html_generator.parse_html_for_line_which_includes_newline(&line)
}
rs_html_generator.finalize()
rs_html_generator.finalize()
}
rustler::init!("Elixir.Ketbin.Utils.Syntax", [add, highlight_text]);