Skip to content

Offline, privacy-first grammar checker. Fast, open-source, Rust-powered

chore: ran `rustfmt` under new version

Elijah Potter285ab8085cf9
diff --git a/harper-comments/src/comment_parsers/go.rs b/harper-comments/src/comment_parsers/go.rs
index c4e7873b6..30bf1af14 100644
--- a/harper-comments/src/comment_parsers/go.rs
+++ b/harper-comments/src/comment_parsers/go.rs
@@ -1,6 +1,6 @@
-use harper_core::parsers::{Markdown, MarkdownOptions, Parser};
use harper_core::Lrc;
use harper_core::Token;
+use harper_core::parsers::{Markdown, MarkdownOptions, Parser};
use super::without_initiators;
diff --git a/harper-comments/src/comment_parsers/jsdoc.rs b/harper-comments/src/comment_parsers/jsdoc.rs
index 663f571f5..e7b46e00a 100644
--- a/harper-comments/src/comment_parsers/jsdoc.rs
+++ b/harper-comments/src/comment_parsers/jsdoc.rs
@@ -1,5 +1,5 @@
-use harper_core::parsers::{Markdown, MarkdownOptions, Parser};
use harper_core::Lrc;
+use harper_core::parsers::{Markdown, MarkdownOptions, Parser};
use harper_core::{Punctuation, Span, Token, TokenKind};
use itertools::Itertools;
@@ -162,7 +162,7 @@ fn parse_inline_tag(tokens: &[Token]) -> Option<usize> {
#[cfg(test)]
mod tests {
- use harper_core::{parsers::MarkdownOptions, Document, Punctuation, TokenKind};
+ use harper_core::{Document, Punctuation, TokenKind, parsers::MarkdownOptions};
use crate::CommentParser;
@@ -226,8 +226,10 @@ mod tests {
CommentParser::new_from_language_id("javascript", MarkdownOptions::default()).unwrap();
let document = Document::new_curated(source, &parser);
- assert!(document
- .tokens()
- .all(|t| t.kind.is_unlintable() || t.kind.is_newline() || t.kind.is_paragraph_break()));
+ assert!(
+ document.tokens().all(|t| t.kind.is_unlintable()
+ || t.kind.is_newline()
+ || t.kind.is_paragraph_break())
+ );
}
}
diff --git a/harper-comments/src/comment_parsers/unit.rs b/harper-comments/src/comment_parsers/unit.rs
index 07ec06be9..ad25d72e0 100644
--- a/harper-comments/src/comment_parsers/unit.rs
+++ b/harper-comments/src/comment_parsers/unit.rs
@@ -1,5 +1,5 @@
-use harper_core::parsers::{Markdown, MarkdownOptions, Parser};
use harper_core::Lrc;
+use harper_core::parsers::{Markdown, MarkdownOptions, Parser};
use harper_core::{Span, Token};
use super::without_initiators;
diff --git a/harper-core/benches/parse_demo.rs b/harper-core/benches/parse_demo.rs
index 2cf58d2b5..6298590e5 100644
--- a/harper-core/benches/parse_demo.rs
+++ b/harper-core/benches/parse_demo.rs
@@ -1,4 +1,4 @@
-use criterion::{black_box, criterion_group, criterion_main, Criterion};
+use criterion::{Criterion, black_box, criterion_group, criterion_main};
use harper_core::linting::{LintGroup, Linter};
use harper_core::{Document, FstDictionary};
diff --git a/harper-core/src/document.rs b/harper-core/src/document.rs
index 82e0b4cd1..fc5a88640 100644
--- a/harper-core/src/document.rs
+++ b/harper-core/src/document.rs
@@ -602,7 +602,7 @@ mod tests {
use itertools::Itertools;
use super::Document;
- use crate::{parsers::MarkdownOptions, Span};
+ use crate::{Span, parsers::MarkdownOptions};
fn assert_condensed_contractions(text: &str, final_tok_count: usize) {
let document = Document::new_plain_english_curated(text);
diff --git a/harper-core/src/ignored_lints/lint_context.rs b/harper-core/src/ignored_lints/lint_context.rs
index 9487cc4b8..f502a44b0 100644
--- a/harper-core/src/ignored_lints/lint_context.rs
+++ b/harper-core/src/ignored_lints/lint_context.rs
@@ -1,8 +1,8 @@
use serde::{Deserialize, Serialize};
use crate::{
- linting::{Lint, LintKind, Suggestion},
Document, FatToken,
+ linting::{Lint, LintKind, Suggestion},
};
/// A location-agnostic structure that attempts to captures the context and content that a [`Lint`]
diff --git a/harper-core/src/ignored_lints/mod.rs b/harper-core/src/ignored_lints/mod.rs
index f22dbdb44..335e595e5 100644
--- a/harper-core/src/ignored_lints/mod.rs
+++ b/harper-core/src/ignored_lints/mod.rs
@@ -6,7 +6,7 @@ use hashbrown::HashSet;
use lint_context::LintContext;
use serde::{Deserialize, Serialize};
-use crate::{linting::Lint, Document};
+use crate::{Document, linting::Lint};
/// A structure that keeps track of lints that have been ignored by users.
#[derive(Debug, Default, Serialize, Deserialize)]
@@ -59,8 +59,8 @@ mod tests {
use super::IgnoredLints;
use crate::{
- linting::{LintGroup, Linter},
Document, FstDictionary,
+ linting::{LintGroup, Linter},
};
#[quickcheck]
diff --git a/harper-core/src/lexing/email_address.rs b/harper-core/src/lexing/email_address.rs
index 92038116d..5a4119f70 100644
--- a/harper-core/src/lexing/email_address.rs
+++ b/harper-core/src/lexing/email_address.rs
@@ -1,7 +1,7 @@
use itertools::Itertools;
-use super::hostname::lex_hostname;
use super::FoundToken;
+use super::hostname::lex_hostname;
use crate::TokenKind;
pub fn lex_email_address(source: &[char]) -> Option<FoundToken> {
diff --git a/harper-core/src/lexing/url.rs b/harper-core/src/lexing/url.rs
index 841d3c24f..c028f8e1a 100644
--- a/harper-core/src/lexing/url.rs
+++ b/harper-core/src/lexing/url.rs
@@ -1,6 +1,6 @@
/// This module implements parsing of URIs.
/// See RFC 1738 for more information.
-use super::{hostname::lex_hostname, FoundToken};
+use super::{FoundToken, hostname::lex_hostname};
use crate::TokenKind;
pub fn lex_url(source: &[char]) -> Option<FoundToken> {
diff --git a/harper-core/src/lib.rs b/harper-core/src/lib.rs
index 6812ce37e..e522dd8f3 100644
--- a/harper-core/src/lib.rs
+++ b/harper-core/src/lib.rs
@@ -75,8 +75,9 @@ pub fn remove_overlaps(lints: &mut Vec<Lint>) {
#[cfg(test)]
mod tests {
use crate::{
+ Document, FstDictionary,
linting::{LintGroup, Linter},
- remove_overlaps, Document, FstDictionary,
+ remove_overlaps,
};
#[test]
diff --git a/harper-core/src/linting/back_in_the_day.rs b/harper-core/src/linting/back_in_the_day.rs
index 645333d71..2ce000507 100644
--- a/harper-core/src/linting/back_in_the_day.rs
+++ b/harper-core/src/linting/back_in_the_day.rs
@@ -1,6 +1,6 @@
use crate::{
- patterns::{ExactPhrase, OwnedPatternExt, Pattern, SequencePattern, WordSet},
Lrc, Token, TokenStringExt,
+ patterns::{ExactPhrase, OwnedPatternExt, Pattern, SequencePattern, WordSet},
};
use super::{Lint, LintKind, PatternLinter, Suggestion};
diff --git a/harper-core/src/linting/boring_words.rs b/harper-core/src/linting/boring_words.rs
index c666d93b4..2469e5e56 100644
--- a/harper-core/src/linting/boring_words.rs
+++ b/harper-core/src/linting/boring_words.rs
@@ -1,6 +1,6 @@
use crate::{
- patterns::{Pattern, WordPatternGroup},
Token, TokenStringExt,
+ patterns::{Pattern, WordPatternGroup},
};
use super::{Lint, LintKind, PatternLinter};
diff --git a/harper-core/src/linting/chock_full.rs b/harper-core/src/linting/chock_full.rs
index 346f92944..950b651c9 100644
--- a/harper-core/src/linting/chock_full.rs
+++ b/harper-core/src/linting/chock_full.rs
@@ -1,6 +1,6 @@
use crate::{
- patterns::{EitherPattern, Pattern, SequencePattern, WhitespacePattern, WordSet},
Token, TokenStringExt,
+ patterns::{EitherPattern, Pattern, SequencePattern, WhitespacePattern, WordSet},
};
use super::{Lint, LintKind, PatternLinter, Suggestion};
diff --git a/harper-core/src/linting/compound_nouns/general_compound_nouns.rs b/harper-core/src/linting/compound_nouns/general_compound_nouns.rs
index 00ea4cd76..f1c795d5a 100644
--- a/harper-core/src/linting/compound_nouns/general_compound_nouns.rs
+++ b/harper-core/src/linting/compound_nouns/general_compound_nouns.rs
@@ -1,14 +1,14 @@
use crate::{
+ CharStringExt, TokenStringExt,
linting::PatternLinter,
patterns::{All, SplitCompoundWord},
- CharStringExt, TokenStringExt,
};
use super::{Lint, LintKind, Suggestion};
use crate::{
- patterns::{Pattern, SequencePattern},
Lrc, Token,
+ patterns::{Pattern, SequencePattern},
};
/// Covers the general cases of accidentally split compound nouns.
diff --git a/harper-core/src/linting/compound_nouns/implied_ownership_compound_nouns.rs b/harper-core/src/linting/compound_nouns/implied_ownership_compound_nouns.rs
index 5632ca5df..8a9294b5e 100644
--- a/harper-core/src/linting/compound_nouns/implied_ownership_compound_nouns.rs
+++ b/harper-core/src/linting/compound_nouns/implied_ownership_compound_nouns.rs
@@ -1,12 +1,12 @@
use crate::{
- linting::PatternLinter, patterns::SplitCompoundWord, CharStringExt, Lrc, TokenStringExt,
+ CharStringExt, Lrc, TokenStringExt, linting::PatternLinter, patterns::SplitCompoundWord,
};
use super::{Lint, LintKind, Suggestion};
use crate::{
- patterns::{Pattern, SequencePattern},
Token,
+ patterns::{Pattern, SequencePattern},
};
/// Looks for closed compound nouns which can be condensed due to their position after a
diff --git a/harper-core/src/linting/compound_nouns/mod.rs b/harper-core/src/linting/compound_nouns/mod.rs
index 799398910..7f5d95410 100644
--- a/harper-core/src/linting/compound_nouns/mod.rs
+++ b/harper-core/src/linting/compound_nouns/mod.rs
@@ -1,7 +1,7 @@
mod general_compound_nouns;
mod implied_ownership_compound_nouns;
-use super::{merge_linters::merge_linters, Lint, LintKind, Suggestion};
+use super::{Lint, LintKind, Suggestion, merge_linters::merge_linters};
use general_compound_nouns::GeneralCompoundNouns;
use implied_ownership_compound_nouns::ImpliedOwnershipCompoundNouns;
diff --git a/harper-core/src/linting/currency_placement.rs b/harper-core/src/linting/currency_placement.rs
index 502190094..1b13862a4 100644
--- a/harper-core/src/linting/currency_placement.rs
+++ b/harper-core/src/linting/currency_placement.rs
@@ -1,6 +1,6 @@
use itertools::Itertools;
-use crate::{remove_overlaps, Document, Token, TokenStringExt};
+use crate::{Document, Token, TokenStringExt, remove_overlaps};
use super::{Lint, LintKind, Linter, Suggestion};
diff --git a/harper-core/src/linting/dashes.rs b/harper-core/src/linting/dashes.rs
index 27f70737f..6dbbc6a07 100644
--- a/harper-core/src/linting/dashes.rs
+++ b/harper-core/src/linting/dashes.rs
@@ -1,6 +1,6 @@
use crate::{
- patterns::{EitherPattern, Pattern, SequencePattern},
Token, TokenStringExt,
+ patterns::{EitherPattern, Pattern, SequencePattern},
};
use super::{Lint, LintKind, PatternLinter, Suggestion};
diff --git a/harper-core/src/linting/despite_of.rs b/harper-core/src/linting/despite_of.rs
index 566fd62f2..90ed3d9f8 100644
--- a/harper-core/src/linting/despite_of.rs
+++ b/harper-core/src/linting/despite_of.rs
@@ -1,6 +1,6 @@
use crate::{
- patterns::{Pattern, SequencePattern},
Token, TokenStringExt,
+ patterns::{Pattern, SequencePattern},
};
use super::{Lint, LintKind, PatternLinter, Suggestion};
diff --git a/harper-core/src/linting/expand_time_shorthands.rs b/harper-core/src/linting/expand_time_shorthands.rs
index 38645d735..32976303b 100644
--- a/harper-core/src/linting/expand_time_shorthands.rs
+++ b/harper-core/src/linting/expand_time_shorthands.rs
@@ -1,9 +1,9 @@
use std::sync::Arc;
use super::{Lint, LintKind, PatternLinter};
+use crate::Token;
use crate::linting::Suggestion;
use crate::patterns::{EitherPattern, ImpliesQuantity, Pattern, SequencePattern, WordSet};
-use crate::Token;
pub struct ExpandTimeShorthands {
pattern: Box<dyn Pattern>,
diff --git a/harper-core/src/linting/hereby.rs b/harper-core/src/linting/hereby.rs
index b49e6bd92..9d486d658 100644
--- a/harper-core/src/linting/hereby.rs
+++ b/harper-core/src/linting/hereby.rs
@@ -1,6 +1,6 @@
use crate::{
- patterns::{Pattern, SequencePattern},
Token, TokenStringExt,
+ patterns::{Pattern, SequencePattern},
};
use super::{Lint, LintKind, PatternLinter, Suggestion};
diff --git a/harper-core/src/linting/hop_hope/to_hop.rs b/harper-core/src/linting/hop_hope/to_hop.rs
index 60c89b697..5a3435a85 100644
--- a/harper-core/src/linting/hop_hope/to_hop.rs
+++ b/harper-core/src/linting/hop_hope/to_hop.rs
@@ -1,8 +1,8 @@
use super::super::{Lint, LintKind, PatternLinter};
use crate::linting::Suggestion;
use crate::patterns::{Pattern, SequencePattern, WordSet};
-use crate::{char_string::char_string, Token};
use crate::{CharString, CharStringExt};
+use crate::{Token, char_string::char_string};
pub struct ToHop {
pattern: Box<dyn Pattern>,
diff --git a/harper-core/src/linting/hop_hope/to_hope.rs b/harper-core/src/linting/hop_hope/to_hope.rs
index ec1d8e1ec..15c667c01 100644
--- a/harper-core/src/linting/hop_hope/to_hope.rs
+++ b/harper-core/src/linting/hop_hope/to_hope.rs
@@ -1,7 +1,7 @@
use super::super::{Lint, LintKind, PatternLinter};
use crate::linting::Suggestion;
use crate::patterns::{Pattern, SequencePattern, WordSet};
-use crate::{char_string::char_string, Token};
+use crate::{Token, char_string::char_string};
pub struct ToHope {
pattern: Box<dyn Pattern>,
diff --git a/harper-core/src/linting/hyphenate_number_day.rs b/harper-core/src/linting/hyphenate_number_day.rs
index 513e2037b..b87105eb1 100644
--- a/harper-core/src/linting/hyphenate_number_day.rs
+++ b/harper-core/src/linting/hyphenate_number_day.rs
@@ -1,6 +1,6 @@
use crate::{
- patterns::{EitherPattern, NounPhrase, Pattern, SequencePattern},
Token,
+ patterns::{EitherPattern, NounPhrase, Pattern, SequencePattern},
};
use super::{Lint, LintKind, PatternLinter, Suggestion};
diff --git a/harper-core/src/linting/left_right_hand.rs b/harper-core/src/linting/left_right_hand.rs
index 3cedc0580..0d641c025 100644
--- a/harper-core/src/linting/left_right_hand.rs
+++ b/harper-core/src/linting/left_right_hand.rs
@@ -1,6 +1,6 @@
use crate::{
- patterns::{Pattern, SequencePattern, WordSet},
Token,
+ patterns::{Pattern, SequencePattern, WordSet},
};
use super::{Lint, LintKind, PatternLinter, Suggestion};
diff --git a/harper-core/src/linting/lets_confusion/let_us_redundancy.rs b/harper-core/src/linting/lets_confusion/let_us_redundancy.rs
index 189c03337..3f959865d 100644
--- a/harper-core/src/linting/lets_confusion/let_us_redundancy.rs
+++ b/harper-core/src/linting/lets_confusion/let_us_redundancy.rs
@@ -1,6 +1,6 @@
use crate::{
- patterns::{Pattern, SequencePattern},
Token, TokenStringExt,
+ patterns::{Pattern, SequencePattern},
};
use crate::linting::{Lint, LintKind, PatternLinter, Suggestion};
diff --git a/harper-core/src/linting/lets_confusion/mod.rs b/harper-core/src/linting/lets_confusion/mod.rs
index 96e58ebc7..455f3c752 100644
--- a/harper-core/src/linting/lets_confusion/mod.rs
+++ b/harper-core/src/linting/lets_confusion/mod.rs
@@ -34,7 +34,11 @@ mod tests {
#[test]
fn from_harper_docs() {
- assert_suggestion_result("Often the longest and the shortest words are the most helpful, so lets push them first.", LetsConfusion::default(), "Often the longest and the shortest words are the most helpful, so let's push them first.");
+ assert_suggestion_result(
+ "Often the longest and the shortest words are the most helpful, so lets push them first.",
+ LetsConfusion::default(),
+ "Often the longest and the shortest words are the most helpful, so let's push them first.",
+ );
}
#[test]
diff --git a/harper-core/src/linting/lets_confusion/no_contraction_with_verb.rs b/harper-core/src/linting/lets_confusion/no_contraction_with_verb.rs
index 12f898396..74f426b92 100644
--- a/harper-core/src/linting/lets_confusion/no_contraction_with_verb.rs
+++ b/harper-core/src/linting/lets_confusion/no_contraction_with_verb.rs
@@ -1,7 +1,7 @@
use crate::{
+ Token,
linting::{Lint, LintKind, Suggestion},
patterns::{Pattern, SequencePattern, WordSet},
- Token,
};
use crate::linting::PatternLinter;
diff --git a/harper-core/src/linting/likewise.rs b/harper-core/src/linting/likewise.rs
index 6af86e396..0592e813a 100644
--- a/harper-core/src/linting/likewise.rs
+++ b/harper-core/src/linting/likewise.rs
@@ -1,6 +1,6 @@
use crate::{
- patterns::{All, Invert, Pattern, SequencePattern},
Token, TokenStringExt,
+ patterns::{All, Invert, Pattern, SequencePattern},
};
use super::{Lint, LintKind, PatternLinter, Suggestion};
diff --git a/harper-core/src/linting/lint_group.rs b/harper-core/src/linting/lint_group.rs
index 80d1472c1..9e68b7703 100644
--- a/harper-core/src/linting/lint_group.rs
+++ b/harper-core/src/linting/lint_group.rs
@@ -5,6 +5,7 @@ use cached::proc_macro::cached;
use hashbrown::HashMap;
use serde::{Deserialize, Serialize};
+use super::Lint;
use super::an_a::AnA;
use super::avoid_curses::AvoidCurses;
use super::back_in_the_day::BackInTheDay;
@@ -51,10 +52,9 @@ use super::was_aloud::WasAloud;
use super::whereas::Whereas;
use super::wordpress_dotcom::WordPressDotcom;
use super::wrong_quotes::WrongQuotes;
-use super::Lint;
use super::{CurrencyPlacement, Linter, NoOxfordComma, OxfordComma};
-use crate::linting::{closed_compounds, phrase_corrections};
use crate::Document;
+use crate::linting::{closed_compounds, phrase_corrections};
use crate::{Dictionary, MutableDictionary};
#[derive(Debug, Serialize, Deserialize, Default, Clone)]
@@ -279,7 +279,7 @@ impl Linter for LintGroup {
mod tests {
use std::sync::Arc;
- use crate::{linting::Linter, Document, FstDictionary, MutableDictionary};
+ use crate::{Document, FstDictionary, MutableDictionary, linting::Linter};
use super::LintGroup;
diff --git a/harper-core/src/linting/multiple_sequential_pronouns.rs b/harper-core/src/linting/multiple_sequential_pronouns.rs
index cfdb4462e..310668bc9 100644
--- a/harper-core/src/linting/multiple_sequential_pronouns.rs
+++ b/harper-core/src/linting/multiple_sequential_pronouns.rs
@@ -1,5 +1,5 @@
-use super::pattern_linter::PatternLinter;
use super::Suggestion;
+use super::pattern_linter::PatternLinter;
use crate::linting::LintKind;
use crate::patterns::{Pattern, SequencePattern, WordSet};
use crate::{Lint, Lrc, Token, TokenStringExt};
diff --git a/harper-core/src/linting/no_oxford_comma.rs b/harper-core/src/linting/no_oxford_comma.rs
index 34759ae23..f35603f4b 100644
--- a/harper-core/src/linting/no_oxford_comma.rs
+++ b/harper-core/src/linting/no_oxford_comma.rs
@@ -1,6 +1,6 @@
use crate::{
- patterns::{NounPhrase, Pattern, SequencePattern, WordSet},
Document, Token, TokenStringExt,
+ patterns::{NounPhrase, Pattern, SequencePattern, WordSet},
};
use super::{Lint, LintKind, Linter, Suggestion};
@@ -138,12 +138,20 @@ mod tests {
#[test]
fn allows_clean_nations() {
- assert_lint_count("The team consists of players from different countries: France, Germany, Italy and Spain.", NoOxfordComma::default(), 0);
+ assert_lint_count(
+ "The team consists of players from different countries: France, Germany, Italy and Spain.",
+ NoOxfordComma::default(),
+ 0,
+ );
}
#[test]
fn or_writing() {
- assert_suggestion_result("Harper can be a lifesaver when writing technical documents, emails, or other formal forms of communication.", NoOxfordComma::default(), "Harper can be a lifesaver when writing technical documents, emails or other formal forms of communication.",);
+ assert_suggestion_result(
+ "Harper can be a lifesaver when writing technical documents, emails, or other formal forms of communication.",
+ NoOxfordComma::default(),
+ "Harper can be a lifesaver when writing technical documents, emails or other formal forms of communication.",
+ );
}
#[test]
diff --git a/harper-core/src/linting/nobody.rs b/harper-core/src/linting/nobody.rs
index bb3bc196b..68b6d7403 100644
--- a/harper-core/src/linting/nobody.rs
+++ b/harper-core/src/linting/nobody.rs
@@ -1,6 +1,6 @@
use crate::{
- patterns::{Pattern, SequencePattern},
Token, TokenStringExt,
+ patterns::{Pattern, SequencePattern},
};
use super::{Lint, LintKind, PatternLinter, Suggestion};
diff --git a/harper-core/src/linting/out_of_date.rs b/harper-core/src/linting/out_of_date.rs
index 2cd41444a..00c31fd9c 100644
--- a/harper-core/src/linting/out_of_date.rs
+++ b/harper-core/src/linting/out_of_date.rs
@@ -1,6 +1,6 @@
use crate::{
- patterns::{EitherPattern, ExactPhrase, Pattern},
Token, TokenStringExt,
+ patterns::{EitherPattern, ExactPhrase, Pattern},
};
use super::{Lint, LintKind, PatternLinter, Suggestion};
diff --git a/harper-core/src/linting/oxford_comma.rs b/harper-core/src/linting/oxford_comma.rs
index 1ff655c97..ccf2868fc 100644
--- a/harper-core/src/linting/oxford_comma.rs
+++ b/harper-core/src/linting/oxford_comma.rs
@@ -1,6 +1,6 @@
use crate::{
- patterns::{NounPhrase, Pattern, SequencePattern, WordSet},
Document, Token, TokenStringExt,
+ patterns::{NounPhrase, Pattern, SequencePattern, WordSet},
};
use super::{Lint, LintKind, Linter, Suggestion};
@@ -137,12 +137,20 @@ mod tests {
#[test]
fn allows_clean_nations() {
- assert_lint_count("The team consists of players from different countries: France, Germany, Italy, and Spain.", OxfordComma::default(), 0);
+ assert_lint_count(
+ "The team consists of players from different countries: France, Germany, Italy, and Spain.",
+ OxfordComma::default(),
+ 0,
+ );
}
#[test]
fn or_writing() {
- assert_suggestion_result("Harper can be a lifesaver when writing technical documents, emails or other formal forms of communication.", OxfordComma::default(), "Harper can be a lifesaver when writing technical documents, emails, or other formal forms of communication.",);
+ assert_suggestion_result(
+ "Harper can be a lifesaver when writing technical documents, emails or other formal forms of communication.",
+ OxfordComma::default(),
+ "Harper can be a lifesaver when writing technical documents, emails, or other formal forms of communication.",
+ );
}
#[test]
diff --git a/harper-core/src/linting/pique_interest.rs b/harper-core/src/linting/pique_interest.rs
index c72e4e81f..8ab62767e 100644
--- a/harper-core/src/linting/pique_interest.rs
+++ b/harper-core/src/linting/pique_interest.rs
@@ -1,7 +1,7 @@
use crate::{
+ CharString, CharStringExt, Token,
char_string::char_string,
patterns::{Pattern, SequencePattern, WordSet},
- CharString, CharStringExt, Token,
};
use super::{Lint, LintKind, PatternLinter, Suggestion};
diff --git a/harper-core/src/linting/plural_conjugate.rs b/harper-core/src/linting/plural_conjugate.rs
index 912c67026..0fd7ac4dd 100644
--- a/harper-core/src/linting/plural_conjugate.rs
+++ b/harper-core/src/linting/plural_conjugate.rs
@@ -1,6 +1,6 @@
use crate::{
- patterns::{EitherPattern, Pattern, SequencePattern},
Token,
+ patterns::{EitherPattern, Pattern, SequencePattern},
};
use super::{Lint, LintKind, PatternLinter, Suggestion};
diff --git a/harper-core/src/linting/possessive_your.rs b/harper-core/src/linting/possessive_your.rs
index 59e6aa95b..06a2416f0 100644
--- a/harper-core/src/linting/possessive_your.rs
+++ b/harper-core/src/linting/possessive_your.rs
@@ -1,6 +1,6 @@
use crate::{
- patterns::{Pattern, SequencePattern},
Token,
+ patterns::{Pattern, SequencePattern},
};
use super::{Lint, LintKind, PatternLinter, Suggestion};
diff --git a/harper-core/src/linting/pronoun_contraction/avoid_contraction.rs b/harper-core/src/linting/pronoun_contraction/avoid_contraction.rs
index 686a364ce..8f950309b 100644
--- a/harper-core/src/linting/pronoun_contraction/avoid_contraction.rs
+++ b/harper-core/src/linting/pronoun_contraction/avoid_contraction.rs
@@ -1,6 +1,6 @@
use crate::{
- patterns::{Pattern, SequencePattern},
Token,
+ patterns::{Pattern, SequencePattern},
};
use super::super::{Lint, LintKind, PatternLinter, Suggestion};
diff --git a/harper-core/src/linting/pronoun_contraction/should_contract.rs b/harper-core/src/linting/pronoun_contraction/should_contract.rs
index 1fef75c02..af480636d 100644
--- a/harper-core/src/linting/pronoun_contraction/should_contract.rs
+++ b/harper-core/src/linting/pronoun_contraction/should_contract.rs
@@ -1,10 +1,10 @@
use crate::{
- patterns::{Pattern, SequencePattern, WordSet},
CharStringExt, Token,
+ patterns::{Pattern, SequencePattern, WordSet},
};
-use crate::linting::{LintKind, PatternLinter, Suggestion};
use crate::Lint;
+use crate::linting::{LintKind, PatternLinter, Suggestion};
pub struct ShouldContract {
pattern: Box<dyn Pattern>,
diff --git a/harper-core/src/linting/proper_noun_capitalization_linters.rs b/harper-core/src/linting/proper_noun_capitalization_linters.rs
index d03c2c2fb..d58ff9c88 100644
--- a/harper-core/src/linting/proper_noun_capitalization_linters.rs
+++ b/harper-core/src/linting/proper_noun_capitalization_linters.rs
@@ -1,7 +1,7 @@
use super::{Lint, LintKind, Suggestion};
use super::{LintGroup, PatternLinter};
use crate::patterns::{EitherPattern, IsNotTitleCase, Pattern, SequencePattern, WordSet};
-use crate::{make_title_case, Dictionary};
+use crate::{Dictionary, make_title_case};
use crate::{Token, TokenStringExt};
use std::sync::Arc;
@@ -888,8 +888,8 @@ pub fn lint_group(dictionary: Arc<impl Dictionary + 'static>) -> LintGroup {
#[cfg(test)]
mod tests {
use crate::{
- linting::tests::{assert_lint_count, assert_suggestion_result},
FstDictionary,
+ linting::tests::{assert_lint_count, assert_suggestion_result},
};
use super::lint_group;
diff --git a/harper-core/src/linting/repeated_words.rs b/harper-core/src/linting/repeated_words.rs
index 79fb4ac39..779b2a373 100644
--- a/harper-core/src/linting/repeated_words.rs
+++ b/harper-core/src/linting/repeated_words.rs
@@ -102,7 +102,11 @@ mod tests {
#[test]
fn issue_253() {
- assert_lint_count("this paper shows that, while the method may be more accurate accurate, the turnout overestimate suggests that self-selection bias is not sufficiently reduced", RepeatedWords::default(), 1);
+ assert_lint_count(
+ "this paper shows that, while the method may be more accurate accurate, the turnout overestimate suggests that self-selection bias is not sufficiently reduced",
+ RepeatedWords::default(),
+ 1,
+ );
}
#[test]
diff --git a/harper-core/src/linting/somewhat_something.rs b/harper-core/src/linting/somewhat_something.rs
index 6d3508fd4..680196156 100644
--- a/harper-core/src/linting/somewhat_something.rs
+++ b/harper-core/src/linting/somewhat_something.rs
@@ -1,6 +1,6 @@
use crate::{
- patterns::{Pattern, SequencePattern},
Token,
+ patterns::{Pattern, SequencePattern},
};
use super::{Lint, LintKind, PatternLinter, Suggestion};
diff --git a/harper-core/src/linting/spell_check.rs b/harper-core/src/linting/spell_check.rs
index eef15c04c..11a7c2194 100644
--- a/harper-core/src/linting/spell_check.rs
+++ b/harper-core/src/linting/spell_check.rs
@@ -114,8 +114,8 @@ impl<T: Dictionary> Linter for SpellCheck<T> {
#[cfg(test)]
mod tests {
use crate::{
- linting::tests::{assert_lint_count, assert_suggestion_result},
FstDictionary,
+ linting::tests::{assert_lint_count, assert_suggestion_result},
};
use super::SpellCheck;
diff --git a/harper-core/src/linting/spelled_numbers.rs b/harper-core/src/linting/spelled_numbers.rs
index 198111e63..558851aab 100644
--- a/harper-core/src/linting/spelled_numbers.rs
+++ b/harper-core/src/linting/spelled_numbers.rs
@@ -103,7 +103,7 @@ fn spell_out_number(num: u64) -> Option<String> {
mod tests {
use crate::linting::tests::assert_suggestion_result;
- use super::{spell_out_number, SpelledNumbers};
+ use super::{SpelledNumbers, spell_out_number};
#[test]
fn produces_zero() {
diff --git a/harper-core/src/linting/that_which.rs b/harper-core/src/linting/that_which.rs
index 0edf12ad4..cafd7fa4b 100644
--- a/harper-core/src/linting/that_which.rs
+++ b/harper-core/src/linting/that_which.rs
@@ -1,8 +1,8 @@
use itertools::Itertools;
use crate::{
- patterns::{Pattern, SequencePattern, WordPatternGroup},
Lrc, Token, TokenStringExt,
+ patterns::{Pattern, SequencePattern, WordPatternGroup},
};
use super::{Lint, LintKind, PatternLinter, Suggestion};
diff --git a/harper-core/src/linting/then_than.rs b/harper-core/src/linting/then_than.rs
index 1c1217798..08ec5ba83 100644
--- a/harper-core/src/linting/then_than.rs
+++ b/harper-core/src/linting/then_than.rs
@@ -1,7 +1,7 @@
use super::{Lint, LintKind, PatternLinter};
+use crate::Token;
use crate::linting::Suggestion;
use crate::patterns::{All, Invert, OwnedPatternExt, Pattern, SequencePattern, WordSet};
-use crate::Token;
#[doc = "Corrects the misuse of `then` to `than`."]
pub struct ThenThan {
diff --git a/harper-core/src/linting/was_aloud.rs b/harper-core/src/linting/was_aloud.rs
index dab7148e8..4ff04fc1a 100644
--- a/harper-core/src/linting/was_aloud.rs
+++ b/harper-core/src/linting/was_aloud.rs
@@ -1,8 +1,8 @@
use super::{Lint, LintKind, PatternLinter};
-use crate::linting::Suggestion;
-use crate::patterns::{Pattern, SequencePattern, WordSet};
use crate::Token;
use crate::TokenStringExt;
+use crate::linting::Suggestion;
+use crate::patterns::{Pattern, SequencePattern, WordSet};
pub struct WasAloud {
pattern: Box<dyn Pattern>,
diff --git a/harper-core/src/linting/whereas.rs b/harper-core/src/linting/whereas.rs
index ccd40ca82..8b37b39a4 100644
--- a/harper-core/src/linting/whereas.rs
+++ b/harper-core/src/linting/whereas.rs
@@ -1,6 +1,6 @@
use crate::{
- patterns::{Pattern, SequencePattern},
Token, TokenStringExt,
+ patterns::{Pattern, SequencePattern},
};
use super::{Lint, LintKind, PatternLinter, Suggestion};
diff --git a/harper-core/src/parsers/collapse_identifiers.rs b/harper-core/src/parsers/collapse_identifiers.rs
index 0ed63e49d..7a793c8e0 100644
--- a/harper-core/src/parsers/collapse_identifiers.rs
+++ b/harper-core/src/parsers/collapse_identifiers.rs
@@ -60,8 +60,8 @@ impl Parser for CollapseIdentifiers {
#[cfg(test)]
mod tests {
use crate::{
- parsers::{PlainEnglish, StrParser},
FstDictionary, MergedDictionary, MutableDictionary, WordMetadata,
+ parsers::{PlainEnglish, StrParser},
};
use super::*;
diff --git a/harper-core/src/parsers/isolate_english.rs b/harper-core/src/parsers/isolate_english.rs
index c3be0e2eb..49e50d465 100644
--- a/harper-core/src/parsers/isolate_english.rs
+++ b/harper-core/src/parsers/isolate_english.rs
@@ -1,4 +1,4 @@
-use crate::{language_detection::is_likely_english, Dictionary};
+use crate::{Dictionary, language_detection::is_likely_english};
use super::{Parser, Token, TokenStringExt};
@@ -36,7 +36,7 @@ impl<D: Dictionary> Parser for IsolateEnglish<D> {
#[cfg(test)]
mod tests {
- use crate::{parsers::PlainEnglish, Document, FstDictionary, TokenStringExt};
+ use crate::{Document, FstDictionary, TokenStringExt, parsers::PlainEnglish};
use super::IsolateEnglish;
diff --git a/harper-core/src/parsers/markdown.rs b/harper-core/src/parsers/markdown.rs
index 16e40cb18..6b1c32ec8 100644
--- a/harper-core/src/parsers/markdown.rs
+++ b/harper-core/src/parsers/markdown.rs
@@ -295,7 +295,7 @@ impl Parser for Markdown {
mod tests {
use super::super::StrParser;
use super::Markdown;
- use crate::{parsers::markdown::MarkdownOptions, Punctuation, TokenKind, TokenStringExt};
+ use crate::{Punctuation, TokenKind, TokenStringExt, parsers::markdown::MarkdownOptions};
#[test]
fn survives_emojis() {
diff --git a/harper-core/src/parsers/plain_english.rs b/harper-core/src/parsers/plain_english.rs
index 9111cb77f..a1fa6fa2e 100644
--- a/harper-core/src/parsers/plain_english.rs
+++ b/harper-core/src/parsers/plain_english.rs
@@ -1,5 +1,5 @@
use super::Parser;
-use crate::lexing::{lex_token, FoundToken};
+use crate::lexing::{FoundToken, lex_token};
use crate::{Span, Token};
/// A parser that will attempt to lex as many tokens as possible,
diff --git a/harper-core/src/patterns/any_capitalization.rs b/harper-core/src/patterns/any_capitalization.rs
index 282b33748..01c4b6fd2 100644
--- a/harper-core/src/patterns/any_capitalization.rs
+++ b/harper-core/src/patterns/any_capitalization.rs
@@ -40,10 +40,6 @@ impl Pattern for AnyCapitalization {
.zip(&self.word)
.all(|(a, b)| a.eq_ignore_ascii_case(b));
- if partial_match {
- 1
- } else {
- 0
- }
+ if partial_match { 1 } else { 0 }
}
}
diff --git a/harper-core/src/patterns/any_pattern.rs b/harper-core/src/patterns/any_pattern.rs
index 21d50c928..04312ff59 100644
--- a/harper-core/src/patterns/any_pattern.rs
+++ b/harper-core/src/patterns/any_pattern.rs
@@ -5,10 +5,6 @@ pub struct AnyPattern;
impl Pattern for AnyPattern {
fn matches(&self, tokens: &[crate::Token], _source: &[char]) -> usize {
- if tokens.is_empty() {
- 0
- } else {
- 1
- }
+ if tokens.is_empty() { 0 } else { 1 }
}
}
diff --git a/harper-core/src/patterns/implies_quantity.rs b/harper-core/src/patterns/implies_quantity.rs
index 6e0ce52e3..bbe06926f 100644
--- a/harper-core/src/patterns/implies_quantity.rs
+++ b/harper-core/src/patterns/implies_quantity.rs
@@ -48,8 +48,8 @@ impl Pattern for ImpliesQuantity {
#[cfg(test)]
mod tests {
use crate::{
- patterns::{DocPattern, ImpliesQuantity},
Document, Span,
+ patterns::{DocPattern, ImpliesQuantity},
};
#[test]
diff --git a/harper-core/src/patterns/is_not_title_case.rs b/harper-core/src/patterns/is_not_title_case.rs
index 5821159c2..3fbac500a 100644
--- a/harper-core/src/patterns/is_not_title_case.rs
+++ b/harper-core/src/patterns/is_not_title_case.rs
@@ -1,4 +1,4 @@
-use crate::{make_title_case, Dictionary, Token, TokenStringExt};
+use crate::{Dictionary, Token, TokenStringExt, make_title_case};
use super::Pattern;
diff --git a/harper-core/src/patterns/mod.rs b/harper-core/src/patterns/mod.rs
index 43b9e2a18..738397930 100644
--- a/harper-core/src/patterns/mod.rs
+++ b/harper-core/src/patterns/mod.rs
@@ -134,11 +134,7 @@ where
let tok = &tokens[0];
- if self(tok, source) {
- 1
- } else {
- 0
- }
+ if self(tok, source) { 1 } else { 0 }
}
}
@@ -154,11 +150,7 @@ where
let tok = &tokens[0];
- if self(tok, source) {
- 1
- } else {
- 0
- }
+ if self(tok, source) { 1 } else { 0 }
}
}
diff --git a/harper-core/src/patterns/naive_pattern_group.rs b/harper-core/src/patterns/naive_pattern_group.rs
index 4d3658f69..1629330b1 100644
--- a/harper-core/src/patterns/naive_pattern_group.rs
+++ b/harper-core/src/patterns/naive_pattern_group.rs
@@ -21,11 +21,7 @@ impl Pattern for NaivePatternGroup {
.find_map(|p| {
let res = p.matches(tokens, source);
- if res != 0 {
- Some(res)
- } else {
- None
- }
+ if res != 0 { Some(res) } else { None }
})
.unwrap_or_default()
}
diff --git a/harper-core/src/patterns/noun_phrase.rs b/harper-core/src/patterns/noun_phrase.rs
index cc0becce5..4a69959c5 100644
--- a/harper-core/src/patterns/noun_phrase.rs
+++ b/harper-core/src/patterns/noun_phrase.rs
@@ -40,7 +40,7 @@ impl Pattern for NounPhrase {
mod tests {
use super::super::DocPattern;
use super::NounPhrase;
- use crate::{patterns::Pattern, Document, Span};
+ use crate::{Document, Span, patterns::Pattern};
#[test]
fn simple_apple() {
diff --git a/harper-core/src/patterns/repeating_pattern.rs b/harper-core/src/patterns/repeating_pattern.rs
index a400abacc..ffc32e2c0 100644
--- a/harper-core/src/patterns/repeating_pattern.rs
+++ b/harper-core/src/patterns/repeating_pattern.rs
@@ -43,8 +43,8 @@ impl Pattern for RepeatingPattern {
#[cfg(test)]
mod tests {
use super::RepeatingPattern;
- use crate::patterns::{AnyPattern, Pattern};
use crate::Document;
+ use crate::patterns::{AnyPattern, Pattern};
#[test]
fn matches_anything() {
diff --git a/harper-core/src/patterns/sequence_pattern.rs b/harper-core/src/patterns/sequence_pattern.rs
index 770223b23..19983967e 100644
--- a/harper-core/src/patterns/sequence_pattern.rs
+++ b/harper-core/src/patterns/sequence_pattern.rs
@@ -200,8 +200,8 @@ impl Pattern for SequencePattern {
mod tests {
use super::SequencePattern;
- use crate::patterns::Pattern;
use crate::Document;
+ use crate::patterns::Pattern;
#[test]
fn matches_n_whitespace_tokens() {
diff --git a/harper-core/src/patterns/similar_to_phrase.rs b/harper-core/src/patterns/similar_to_phrase.rs
index 190ad454c..d464d63bf 100644
--- a/harper-core/src/patterns/similar_to_phrase.rs
+++ b/harper-core/src/patterns/similar_to_phrase.rs
@@ -1,7 +1,7 @@
use crate::{Document, Token, TokenKind};
use super::{
- within_edit_distance::WithinEditDistance, AnyCapitalization, Pattern, SequencePattern,
+ AnyCapitalization, Pattern, SequencePattern, within_edit_distance::WithinEditDistance,
};
pub struct SimilarToPhrase {
diff --git a/harper-core/src/patterns/word_set.rs b/harper-core/src/patterns/word_set.rs
index 32d79e861..e1f5c0c54 100644
--- a/harper-core/src/patterns/word_set.rs
+++ b/harper-core/src/patterns/word_set.rs
@@ -66,7 +66,7 @@ impl Pattern for WordSet {
#[cfg(test)]
mod tests {
- use crate::{patterns::DocPattern, Document, Span};
+ use crate::{Document, Span, patterns::DocPattern};
use super::WordSet;
diff --git a/harper-core/src/spell/fst_dictionary.rs b/harper-core/src/spell/fst_dictionary.rs
index 89bb279c8..75afcbc7d 100644
--- a/harper-core/src/spell/fst_dictionary.rs
+++ b/harper-core/src/spell/fst_dictionary.rs
@@ -1,11 +1,12 @@
use super::{
+ MutableDictionary,
hunspell::{parse_default_attribute_list, parse_default_word_list},
- seq_to_normalized, MutableDictionary,
+ seq_to_normalized,
};
-use fst::{map::StreamWithState, IntoStreamer, Map as FstMap, Streamer};
+use fst::{IntoStreamer, Map as FstMap, Streamer, map::StreamWithState};
use hashbrown::HashMap;
use lazy_static::lazy_static;
-use levenshtein_automata::{LevenshteinAutomatonBuilder, DFA};
+use levenshtein_automata::{DFA, LevenshteinAutomatonBuilder};
use std::{cell::RefCell, sync::Arc};
use crate::{CharString, CharStringExt, WordMetadata};
@@ -235,7 +236,7 @@ mod tests {
use itertools::Itertools;
use crate::CharStringExt;
- use crate::{spell::seq_to_normalized, Dictionary};
+ use crate::{Dictionary, spell::seq_to_normalized};
use super::FstDictionary;
diff --git a/harper-core/src/spell/hunspell/affix_replacement.rs b/harper-core/src/spell/hunspell/affix_replacement.rs
index 41f94114c..851f4c2aa 100644
--- a/harper-core/src/spell/hunspell/affix_replacement.rs
+++ b/harper-core/src/spell/hunspell/affix_replacement.rs
@@ -1,7 +1,7 @@
use serde::{Deserialize, Serialize};
-use super::matcher::Matcher;
use super::Error;
+use super::matcher::Matcher;
#[derive(Debug, Clone)]
pub struct AffixReplacement {
diff --git a/harper-core/src/spell/hunspell/attribute_list.rs b/harper-core/src/spell/hunspell/attribute_list.rs
index 182d29fbb..a97b5da4c 100644
--- a/harper-core/src/spell/hunspell/attribute_list.rs
+++ b/harper-core/src/spell/hunspell/attribute_list.rs
@@ -2,10 +2,10 @@ use hashbrown::HashMap;
use serde::{Deserialize, Serialize};
use smallvec::ToSmallVec;
+use super::Error;
use super::affix_replacement::AffixReplacement;
use super::expansion::{Expansion, HumanReadableExpansion};
use super::word_list::MarkedWord;
-use super::Error;
use crate::{CharString, Span, WordMetadata};
#[derive(Debug, Clone)]
diff --git a/harper-core/src/spell/hunspell/expansion.rs b/harper-core/src/spell/hunspell/expansion.rs
index 3711681b9..9de030e6e 100644
--- a/harper-core/src/spell/hunspell/expansion.rs
+++ b/harper-core/src/spell/hunspell/expansion.rs
@@ -1,7 +1,7 @@
use serde::{Deserialize, Serialize};
-use super::affix_replacement::{AffixReplacement, HumanReadableAffixReplacement};
use super::Error;
+use super::affix_replacement::{AffixReplacement, HumanReadableAffixReplacement};
use crate::WordMetadata;
#[derive(Debug, Clone)]
diff --git a/harper-core/src/spell/hunspell/mod.rs b/harper-core/src/spell/hunspell/mod.rs
index 2e75fb7c2..886548dbf 100644
--- a/harper-core/src/spell/hunspell/mod.rs
+++ b/harper-core/src/spell/hunspell/mod.rs
@@ -9,8 +9,8 @@ pub use attribute_list::AttributeList;
use attribute_list::HumanReadableAttributeList;
pub use error::Error;
-use self::word_list::parse_word_list;
pub use self::word_list::MarkedWord;
+use self::word_list::parse_word_list;
pub fn parse_default_word_list() -> Result<Vec<MarkedWord>, Error> {
parse_word_list(include_str!("../../../dictionary.dict"))
@@ -95,10 +95,12 @@ mod tests {
assert_eq!(
expanded,
- vec!["hello", "tried", "reworked", "rework", "worked", "work", "try"]
- .into_iter()
- .map(|v| v.into())
- .collect()
+ vec![
+ "hello", "tried", "reworked", "rework", "worked", "work", "try"
+ ]
+ .into_iter()
+ .map(|v| v.into())
+ .collect()
)
}
@@ -203,10 +205,12 @@ mod tests {
#[test]
fn expanded_contains_possessive_abandonment() {
- assert!(build_expanded()
- .get(&split("abandonment's"))
- .unwrap()
- .is_possessive_noun())
+ assert!(
+ build_expanded()
+ .get(&split("abandonment's"))
+ .unwrap()
+ .is_possessive_noun()
+ )
}
#[test]
diff --git a/harper-core/src/spell/merged_dictionary.rs b/harper-core/src/spell/merged_dictionary.rs
index 513808668..9d7eec8a2 100644
--- a/harper-core/src/spell/merged_dictionary.rs
+++ b/harper-core/src/spell/merged_dictionary.rs
@@ -2,7 +2,7 @@ use std::sync::Arc;
use itertools::Itertools;
-use super::{dictionary::Dictionary, FuzzyMatchResult};
+use super::{FuzzyMatchResult, dictionary::Dictionary};
use crate::{CharString, WordMetadata};
/// A simple wrapper over [`Dictionary`] that allows
diff --git a/harper-core/src/spell/mod.rs b/harper-core/src/spell/mod.rs
index 9f0cf0d0d..6e0b53d72 100644
--- a/harper-core/src/spell/mod.rs
+++ b/harper-core/src/spell/mod.rs
@@ -130,8 +130,8 @@ mod tests {
use crate::spell::FuzzyMatchResult;
use super::{
- order_suggestions, seq_to_normalized, suggest_correct_spelling_str, Dictionary,
- FstDictionary, MutableDictionary,
+ Dictionary, FstDictionary, MutableDictionary, order_suggestions, seq_to_normalized,
+ suggest_correct_spelling_str,
};
const RESULT_LIMIT: usize = 100;
diff --git a/harper-core/src/spell/mutable_dictionary.rs b/harper-core/src/spell/mutable_dictionary.rs
index 8b879165b..71c88dac3 100644
--- a/harper-core/src/spell/mutable_dictionary.rs
+++ b/harper-core/src/spell/mutable_dictionary.rs
@@ -11,8 +11,8 @@ use std::sync::Arc;
use crate::{CharString, CharStringExt, WordMetadata};
-use super::dictionary::Dictionary;
use super::FuzzyMatchResult;
+use super::dictionary::Dictionary;
/// A basic dictionary that allows words to be added after instantiating.
/// This is useful for user and file dictionaries that may change at runtime.
@@ -344,14 +344,16 @@ mod tests {
#[test]
fn herself_is_pronoun() {
let dict = MutableDictionary::curated();
- assert!(dict
- .get_word_metadata_str("herself")
- .unwrap()
- .is_pronoun_noun());
- assert!(dict
- .get_word_metadata_str("Herself")
- .unwrap()
- .is_pronoun_noun());
+ assert!(
+ dict.get_word_metadata_str("herself")
+ .unwrap()
+ .is_pronoun_noun()
+ );
+ assert!(
+ dict.get_word_metadata_str("Herself")
+ .unwrap()
+ .is_pronoun_noun()
+ );
}
#[test]
@@ -385,9 +387,11 @@ mod tests {
let dict = MutableDictionary::curated();
assert!(!dict.get_word_metadata_str("there").unwrap().is_noun());
- assert!(!dict
- .get_word_metadata_str("there")
- .unwrap()
- .is_pronoun_noun());
+ assert!(
+ !dict
+ .get_word_metadata_str("there")
+ .unwrap()
+ .is_pronoun_noun()
+ );
}
}
diff --git a/harper-core/src/title_case.rs b/harper-core/src/title_case.rs
index b504151ac..e6876cf89 100644
--- a/harper-core/src/title_case.rs
+++ b/harper-core/src/title_case.rs
@@ -4,7 +4,7 @@ use crate::TokenKind;
use hashbrown::HashSet;
use lazy_static::lazy_static;
-use crate::{parsers::Parser, CharStringExt, Dictionary, Document, TokenStringExt};
+use crate::{CharStringExt, Dictionary, Document, TokenStringExt, parsers::Parser};
/// A helper function for [`make_title_case`] that uses Strings instead of char buffers.
pub fn make_title_case_str(source: &str, parser: &impl Parser, dict: &impl Dictionary) -> String {
@@ -111,8 +111,8 @@ mod tests {
use super::make_title_case_str;
use crate::{
- parsers::{Markdown, PlainEnglish},
FstDictionary,
+ parsers::{Markdown, PlainEnglish},
};
#[test]
diff --git a/harper-core/src/token.rs b/harper-core/src/token.rs
index 22fb79071..8d4e86005 100644
--- a/harper-core/src/token.rs
+++ b/harper-core/src/token.rs
@@ -27,8 +27,8 @@ impl Token {
#[cfg(test)]
mod tests {
use crate::{
- parsers::{Parser, PlainEnglish},
TokenStringExt,
+ parsers::{Parser, PlainEnglish},
};
#[test]
diff --git a/harper-core/src/token_string_ext.rs b/harper-core/src/token_string_ext.rs
index ced049da5..76d7ed18b 100644
--- a/harper-core/src/token_string_ext.rs
+++ b/harper-core/src/token_string_ext.rs
@@ -129,11 +129,7 @@ impl TokenStringExt for [Token] {
return Some(*word);
};
- if w_idx < u_idx {
- Some(*word)
- } else {
- None
- }
+ if w_idx < u_idx { Some(*word) } else { None }
}
fn span(&self) -> Option<Span> {
diff --git a/harper-literate-haskell/src/lib.rs b/harper-literate-haskell/src/lib.rs
index 5e5d8872a..755b90cba 100644
--- a/harper-literate-haskell/src/lib.rs
+++ b/harper-literate-haskell/src/lib.rs
@@ -1,7 +1,7 @@
use harper_comments::CommentParser;
use harper_core::{
- parsers::{Markdown, MarkdownOptions, Mask, Parser},
Lrc, Masker, MutableDictionary, Token,
+ parsers::{Markdown, MarkdownOptions, Mask, Parser},
};
mod masker;
diff --git a/harper-ls/src/backend.rs b/harper-ls/src/backend.rs
index b75d30b72..e4fbf932e 100644
--- a/harper-ls/src/backend.rs
+++ b/harper-ls/src/backend.rs
@@ -2,7 +2,7 @@ use std::collections::HashMap;
use std::path::PathBuf;
use std::sync::Arc;
-use anyhow::{anyhow, Context, Result};
+use anyhow::{Context, Result, anyhow};
use harper_comments::CommentParser;
use harper_core::linting::{LintGroup, LintGroupConfig};
use harper_core::parsers::{CollapseIdentifiers, IsolateEnglish, Markdown, Parser, PlainEnglish};
diff --git a/harper-ls/src/config.rs b/harper-ls/src/config.rs
index cc56963b5..1f8438e1e 100644
--- a/harper-ls/src/config.rs
+++ b/harper-ls/src/config.rs
@@ -1,6 +1,6 @@
use std::path::PathBuf;
-use anyhow::{bail, Result};
+use anyhow::{Result, bail};
use dirs::{config_dir, data_local_dir};
use harper_core::{linting::LintGroupConfig, parsers::MarkdownOptions};
use resolve_path::PathResolveExt;
diff --git a/harper-ls/src/diagnostics.rs b/harper-ls/src/diagnostics.rs
index 581a9a427..a7bad6a1b 100644
--- a/harper-ls/src/diagnostics.rs
+++ b/harper-ls/src/diagnostics.rs
@@ -1,7 +1,7 @@
use std::collections::HashMap;
-use harper_core::linting::{Lint, Suggestion};
use harper_core::CharStringExt;
+use harper_core::linting::{Lint, Suggestion};
use tower_lsp::lsp_types::{
CodeAction, CodeActionKind, CodeActionOrCommand, Command, Diagnostic, TextEdit, Url,
WorkspaceEdit,
diff --git a/harper-ls/src/git_commit_parser.rs b/harper-ls/src/git_commit_parser.rs
index b28bc6bc5..4c1bdb40e 100644
--- a/harper-ls/src/git_commit_parser.rs
+++ b/harper-ls/src/git_commit_parser.rs
@@ -1,5 +1,5 @@
-use harper_core::parsers::{Markdown, MarkdownOptions, Parser};
use harper_core::Lrc;
+use harper_core::parsers::{Markdown, MarkdownOptions, Parser};
/// A Harper parser for Git commit files
#[derive(Clone)]
diff --git a/harper-typst/src/lib.rs b/harper-typst/src/lib.rs
index 10262e9d8..bd9ed1bbf 100644
--- a/harper-typst/src/lib.rs
+++ b/harper-typst/src/lib.rs
@@ -4,11 +4,11 @@ mod typst_translator;
use offset_cursor::OffsetCursor;
use typst_translator::TypstTranslator;
-use harper_core::{parsers::Parser, Token};
+use harper_core::{Token, parsers::Parser};
use itertools::Itertools;
use typst_syntax::{
- ast::{AstNode, Markup},
Source,
+ ast::{AstNode, Markup},
};
/// A parser that wraps Harper's `PlainEnglish` parser allowing one to ingest Typst files.
diff --git a/harper-typst/src/typst_translator.rs b/harper-typst/src/typst_translator.rs
index 3fe8e4aec..9fae53df7 100644
--- a/harper-typst/src/typst_translator.rs
+++ b/harper-typst/src/typst_translator.rs
@@ -1,15 +1,15 @@
use crate::OffsetCursor;
use harper_core::{
- parsers::{PlainEnglish, StrParser},
Punctuation, Token, TokenKind,
+ parsers::{PlainEnglish, StrParser},
};
use itertools::Itertools;
use typst_syntax::{
+ Source,
ast::{
Arg, ArrayItem, AstNode, DestructuringItem, DictItem, Expr, Ident, LetBindingKind, Param,
Pattern, Spread,
},
- Source,
};
/// Directly translate a span ($a) in a Typst source ($doc) to a token.
diff --git a/harper-wasm/src/lib.rs b/harper-wasm/src/lib.rs
index 90cd5f484..076f7ca43 100644
--- a/harper-wasm/src/lib.rs
+++ b/harper-wasm/src/lib.rs
@@ -7,12 +7,12 @@ use harper_core::language_detection::is_doc_likely_english;
use harper_core::linting::{LintGroup, Linter as _};
use harper_core::parsers::{IsolateEnglish, Markdown, Parser, PlainEnglish};
use harper_core::{
- remove_overlaps, CharString, Dictionary, Document, FstDictionary, IgnoredLints, Lrc,
- MergedDictionary, MutableDictionary, WordMetadata,
+ CharString, Dictionary, Document, FstDictionary, IgnoredLints, Lrc, MergedDictionary,
+ MutableDictionary, WordMetadata, remove_overlaps,
};
use serde::{Deserialize, Serialize};
-use wasm_bindgen::prelude::wasm_bindgen;
use wasm_bindgen::JsValue;
+use wasm_bindgen::prelude::wasm_bindgen;
/// Setup the WebAssembly module's logging.
///