Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: apply fmt
Browse files Browse the repository at this point in the history
Nytelife26 committed Nov 7, 2024

Verified

This commit was signed with the committer’s verified signature.
Nytelife26 Tyler J Russell
1 parent 6adbefd commit 8e37580
Showing 4 changed files with 14 additions and 15 deletions.
6 changes: 3 additions & 3 deletions proselint-rs/crates/proselint-checks/src/lib.rs
Original file line number Diff line number Diff line change
@@ -36,9 +36,9 @@ gen_register!(
dates_times,
hedging,
industrial_language,
lexical_illusions,
malapropisms,
misc,
lexical_illusions,
malapropisms,
misc,
);

pub mod mixed_metaphors;
4 changes: 2 additions & 2 deletions proselint-rs/crates/proselint-registry/src/checks.rs
Original file line number Diff line number Diff line change
@@ -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(),
9 changes: 5 additions & 4 deletions proselint-rs/crates/proselint/src/lib.rs
Original file line number Diff line number Diff line change
@@ -49,10 +49,11 @@ fn check(
#[cfg(feature = "demo")] demo: bool,
) -> anyhow::Result<ExitStatus> {
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)
}
10 changes: 4 additions & 6 deletions proselint-rs/crates/proselint/src/utils.rs
Original file line number Diff line number Diff line change
@@ -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<Check> = proselint_checks::REGISTER.to_vec();
println!("found {} checks :)", checks.len());

// TODO: parallelize
let mut errors: Vec<LintResult> = checks
@@ -151,7 +149,7 @@ pub fn lint_path(
if demo {
results.insert(
PathBuf::from("<demo>"),
lint(crate::config::paths::DEMO_DATA, config, "<demo>", false)
lint(crate::config::paths::DEMO_DATA, config, "<demo>", false),
);
return results;
}

0 comments on commit 8e37580

Please sign in to comment.