From f49fde06d3d65052f7fa1b0fc07509a59f4a4648 Mon Sep 17 00:00:00 2001 From: rolv Date: Sun, 22 Dec 2024 15:36:05 +0000 Subject: [PATCH] fix: formatting --- src/cli/check.rs | 16 +++++++++------- src/parsers.rs | 13 ++++++++----- 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/cli/check.rs b/src/cli/check.rs index a1f9c29..b7f927c 100644 --- a/src/cli/check.rs +++ b/src/cli/check.rs @@ -129,14 +129,16 @@ impl ExecuteSubcommand for Command { // If file type is "Auto", guess file type from extension if matches!(self.r#type, FileType::Auto) { file_type = match PathBuf::from(filename).extension().and_then(|e| e.to_str()) { - Some(ext) => match ext { - "typ" => FileType::Typst, - "md" | "mkd" | "mdwn" | "mdown" | "mdtxt" | "mdtext" | "markdown" => { - FileType::Markdown - }, + Some(ext) => { + match ext { + "typ" => FileType::Typst, + "md" | "mkd" | "mdwn" | "mdown" | "mdtxt" | "mdtext" | "markdown" => { + FileType::Markdown + }, - "html" | "htm" => FileType::Html, - _ => FileType::Raw, + "html" | "htm" => FileType::Html, + _ => FileType::Raw, + } }, None => FileType::Raw, }; diff --git a/src/parsers.rs b/src/parsers.rs index d046e1d..febeb6d 100644 --- a/src/parsers.rs +++ b/src/parsers.rs @@ -1,7 +1,8 @@ -//! Utilities for parsing the contents of different file types into a text representation that can -//! be sent to the LanguageTool API. +//! Utilities for parsing the contents of different file types into a text +//! representation that can be sent to the LanguageTool API. -/// Parse the contents of an HTML file into a text format to be sent to the LanguageTool API. +/// Parse the contents of an HTML file into a text format to be sent to the +/// LanguageTool API. #[cfg(feature = "html")] pub fn parse_html(file_content: impl AsRef) -> String { use html_parser::Node; @@ -85,7 +86,8 @@ pub fn parse_html(file_content: impl AsRef) -> String { txt } -/// Parse the contents of a Markdown file into a text format to be sent to the LanguageTool API. +/// Parse the contents of a Markdown file into a text format to be sent to the +/// LanguageTool API. #[cfg(feature = "markdown")] pub fn parse_markdown(file_content: impl AsRef) -> String { use pulldown_cmark::{html, Options, Parser}; @@ -101,7 +103,8 @@ pub fn parse_markdown(file_content: impl AsRef) -> String { parse_html(html) } -/// Parse the contents of a Typst file into a text format to be sent to the LanguageTool API. +/// Parse the contents of a Typst file into a text format to be sent to the +/// LanguageTool API. #[cfg(feature = "typst")] pub fn parse_typst(file_content: impl AsRef) -> String { use typst_syntax::{parse, SyntaxKind, SyntaxNode};