From 8e37580b2f15a008faee08739abb01a4e1ef01db Mon Sep 17 00:00:00 2001 From: Nytelife26 Date: Thu, 7 Nov 2024 23:35:14 +0000 Subject: [PATCH] chore: apply fmt --- proselint-rs/crates/proselint-checks/src/lib.rs | 6 +++--- proselint-rs/crates/proselint-registry/src/checks.rs | 4 ++-- proselint-rs/crates/proselint/src/lib.rs | 9 +++++---- proselint-rs/crates/proselint/src/utils.rs | 10 ++++------ 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/proselint-rs/crates/proselint-checks/src/lib.rs b/proselint-rs/crates/proselint-checks/src/lib.rs index 20f90a498..9eb695d49 100644 --- a/proselint-rs/crates/proselint-checks/src/lib.rs +++ b/proselint-rs/crates/proselint-checks/src/lib.rs @@ -36,9 +36,9 @@ gen_register!( dates_times, hedging, industrial_language, - lexical_illusions, - malapropisms, - misc, + lexical_illusions, + malapropisms, + misc, ); pub mod mixed_metaphors; diff --git a/proselint-rs/crates/proselint-registry/src/checks.rs b/proselint-rs/crates/proselint-registry/src/checks.rs index 00367ef01..7f6847e14 100644 --- a/proselint-rs/crates/proselint-registry/src/checks.rs +++ b/proselint-rs/crates/proselint-registry/src/checks.rs @@ -35,7 +35,7 @@ impl Padding { macro_rules! pad { ($padding:path, $text:expr$(,)?) => { const_format::str_replace!($padding.as_str(), "{}", $text) - } + }; } #[derive(Debug, Clone)] @@ -366,7 +366,7 @@ pub struct Check { impl Check { pub const fn default() -> Self { Check { - check_type: CheckType::CheckFn(&|_, _| { vec![] }), + check_type: CheckType::CheckFn(&|_, _| vec![]), path: "", msg: "", flags: CheckFlags::default(), diff --git a/proselint-rs/crates/proselint/src/lib.rs b/proselint-rs/crates/proselint/src/lib.rs index 5db6e6f63..50d57dd90 100644 --- a/proselint-rs/crates/proselint/src/lib.rs +++ b/proselint-rs/crates/proselint/src/lib.rs @@ -49,10 +49,11 @@ fn check( #[cfg(feature = "demo")] demo: bool, ) -> anyhow::Result { let results = crate::utils::lint_path( - paths.unwrap_or(vec![]), - config, - #[cfg(feature = "demo")] demo, - ); + paths.unwrap_or(vec![]), + config, + #[cfg(feature = "demo")] + demo, + ); print!("{results:?}"); Ok(ExitStatus::Success) } diff --git a/proselint-rs/crates/proselint/src/utils.rs b/proselint-rs/crates/proselint/src/utils.rs index 6a377121d..27e55a1dd 100644 --- a/proselint-rs/crates/proselint/src/utils.rs +++ b/proselint-rs/crates/proselint/src/utils.rs @@ -15,11 +15,8 @@ pub fn get_line_and_column(text: &str, pos: usize) -> (usize, usize) { if pos == 0 { return (0, 0); } - let lines: Vec<&str> = text - .split_at(pos as usize) - .0 - .split_inclusive("\n") - .collect(); + let lines: Vec<&str> = + text.split_at(pos as usize).0.split_inclusive("\n").collect(); (lines.len() - 1, lines.last().unwrap().len()) } @@ -107,6 +104,7 @@ pub fn lint( // TODO: registry let checks: Vec = proselint_checks::REGISTER.to_vec(); + println!("found {} checks :)", checks.len()); // TODO: parallelize let mut errors: Vec = checks @@ -151,7 +149,7 @@ pub fn lint_path( if demo { results.insert( PathBuf::from(""), - lint(crate::config::paths::DEMO_DATA, config, "", false) + lint(crate::config::paths::DEMO_DATA, config, "", false), ); return results; }