From 816332bdd6a0cc953355a25fa400b2350d34b5be Mon Sep 17 00:00:00 2001 From: SphericalKat Date: Tue, 17 Aug 2021 03:24:30 +0530 Subject: [PATCH] chore(native): run cargo fmt Signed-off-by: SphericalKat --- native/ketbin_utils_syntax/src/lib.rs | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/native/ketbin_utils_syntax/src/lib.rs b/native/ketbin_utils_syntax/src/lib.rs index 1007f4c..15acba4 100644 --- a/native/ketbin_utils_syntax/src/lib.rs +++ b/native/ketbin_utils_syntax/src/lib.rs @@ -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]);