Skip to content

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

fix: misc failures

Elijah Potterd466fc9a28a5
diff --git a/harper-core/src/linting/expand_time_shorthands.rs b/harper-core/src/linting/expand_time_shorthands.rs
index 4b67bfc22..816a77dc0 100644
--- a/harper-core/src/linting/expand_time_shorthands.rs
+++ b/harper-core/src/linting/expand_time_shorthands.rs
@@ -37,8 +37,6 @@ impl ExpandTimeShorthands {
}
fn get_replacement(abbreviation: &str, plural: Option<bool>) -> Option<&'static str> {
- dbg!(abbreviation, plural);
-
let is_plural = plural.unwrap_or(matches!(abbreviation, "hrs" | "mins" | "secs" | "msecs"));
match abbreviation {
"hr" | "hrs" => Some(if is_plural { "hours" } else { "hour" }),
diff --git a/harper-core/src/linting/lint_group.rs b/harper-core/src/linting/lint_group.rs
index 1c46c2aa2..80d1472c1 100644
--- a/harper-core/src/linting/lint_group.rs
+++ b/harper-core/src/linting/lint_group.rs
@@ -1,3 +1,4 @@
+use std::collections::BTreeMap;
use std::sync::Arc;
use cached::proc_macro::cached;
@@ -119,14 +120,15 @@ impl LintGroupConfig {
#[derive(Default)]
pub struct LintGroup {
pub config: LintGroupConfig,
- inner: HashMap<String, Box<dyn Linter>>,
+ /// We use a binary map here so the ordering is stable.
+ inner: BTreeMap<String, Box<dyn Linter>>,
}
impl LintGroup {
pub fn empty() -> Self {
Self {
config: LintGroupConfig::default(),
- inner: HashMap::new(),
+ inner: BTreeMap::new(),
}
}
@@ -145,7 +147,10 @@ impl LintGroup {
/// The other lint group will be left empty after this operation.
pub fn merge_from(&mut self, other: &mut LintGroup) {
self.config.merge_from(&mut other.config);
- self.inner.extend(other.inner.drain());
+
+ let other_map = std::mem::take(&mut other.inner);
+
+ self.inner.extend(other_map);
}
/// Set all contained rules to a specific value.
@@ -189,7 +194,7 @@ impl LintGroup {
));
out.merge_from(&mut closed_compounds::lint_group());
- // Add all of the more complex rules to the group.
+ // Add all the more complex rules to the group.
insert_struct_rule!(BackInTheDay, true);
insert_struct_rule!(WordPressDotcom, true);
insert_struct_rule!(OutOfDate, true);
diff --git a/harper-core/src/linting/matcher.rs b/harper-core/src/linting/matcher.rs
index 6cd773759..d3d33ddfb 100644
--- a/harper-core/src/linting/matcher.rs
+++ b/harper-core/src/linting/matcher.rs
@@ -133,7 +133,6 @@ impl Matcher {
// mixing up than/then in context
triggers.extend(pt! {
- "more","then" => "more than",
"then","her" => "than her",
"then","hers" => "than hers",
"then","him" => "than him",
diff --git a/packages/vscode-plugin/src/tests/fixtures/.vscode/settings.json b/packages/vscode-plugin/src/tests/fixtures/.vscode/settings.json
index 231c4441a..66c21a0de 100644
--- a/packages/vscode-plugin/src/tests/fixtures/.vscode/settings.json
+++ b/packages/vscode-plugin/src/tests/fixtures/.vscode/settings.json
@@ -1,5 +1,7 @@
{
- "files.associations": { "git-commit": "git-commit" },
- "harper-ls.linters.spell_check": true,
- "harper-ls.linters.repeated_words": true
+ "files.associations": {
+ "git-commit": "git-commit"
+ },
+ "harper-ls.linters.SpellCheck": true,
+ "harper-ls.linters.RepeatedWords": true
}