Skip to content

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

Appeased clippy

Elijah Potter2cfd8dabc80d
diff --git a/harper-core/src/document.rs b/harper-core/src/document.rs
index ec5c570e3..16c35e218 100644
--- a/harper-core/src/document.rs
+++ b/harper-core/src/document.rs
@@ -291,7 +291,7 @@ fn is_sentence_terminator(punctuation: &Punctuation) -> bool {
#[cfg(test)]
mod tests {
use super::Document;
- use crate::{Span, Token, TokenKind};
+ use crate::Token;
impl Document {
fn from_raw_parts(source: Vec<char>, tokens: Vec<Token>, markdown: bool) -> Self {
diff --git a/harper-core/src/linting/lint_set.rs b/harper-core/src/linting/lint_set.rs
index a5fea8f09..3025135da 100644
--- a/harper-core/src/linting/lint_set.rs
+++ b/harper-core/src/linting/lint_set.rs
@@ -68,7 +68,7 @@ macro_rules! create_simple_builder_methods {
$(
#[doc = "Modifies self, adding the `" $linter "` linter to the set."]
pub fn [<add_$linter:snake>](&mut self) -> &mut Self{
- self.linters.push(Box::new($linter::default()));
+ self.linters.push(Box::<$linter>::default());
self
}
)*
diff --git a/harper-core/src/linting/sentence_capitalization.rs b/harper-core/src/linting/sentence_capitalization.rs
index eacd97b33..bea8e2c30 100644
--- a/harper-core/src/linting/sentence_capitalization.rs
+++ b/harper-core/src/linting/sentence_capitalization.rs
@@ -1,6 +1,6 @@
use itertools::Itertools;
-use crate::{document::Document, parsing::TokenStringExt, Dictionary};
+use crate::{document::Document, parsing::TokenStringExt};
use super::lint::Suggestion;
use super::{Lint, LintKind, Linter};
@@ -45,19 +45,19 @@ mod tests {
#[test]
fn catches_basic() {
- assert_lint_count("there is no way.", SentenceCapitalization::default(), 1)
+ assert_lint_count("there is no way.", SentenceCapitalization, 1)
}
#[test]
fn no_period() {
- assert_lint_count("there is no way", SentenceCapitalization::default(), 1)
+ assert_lint_count("there is no way", SentenceCapitalization, 1)
}
#[test]
fn two_sentence() {
assert_lint_count(
"i have complete conviction. she is guilty",
- SentenceCapitalization::default(),
+ SentenceCapitalization,
2,
)
}
diff --git a/harper-core/src/linting/spell_check.rs b/harper-core/src/linting/spell_check.rs
index b4dc8b9f5..8d931e695 100644
--- a/harper-core/src/linting/spell_check.rs
+++ b/harper-core/src/linting/spell_check.rs
@@ -1,4 +1,4 @@
-use hashbrown::{HashMap, HashSet};
+use hashbrown::HashMap;
use super::{Lint, LintKind, Linter};
use crate::{
diff --git a/harper-core/src/linting/wrong_quotes.rs b/harper-core/src/linting/wrong_quotes.rs
index 8446a083c..3ef8ac928 100644
--- a/harper-core/src/linting/wrong_quotes.rs
+++ b/harper-core/src/linting/wrong_quotes.rs
@@ -1,6 +1,6 @@
use crate::{document::Document, Suggestion, Token};
-use super::{Lint, LintKind, Linter};
+use super::{Lint, Linter};
#[derive(Debug, Clone, Copy, Default)]
pub struct WrongQuotes;
diff --git a/harper-ls/src/backend.rs b/harper-ls/src/backend.rs
index 6e82ad922..8e9b2d779 100644
--- a/harper-ls/src/backend.rs
+++ b/harper-ls/src/backend.rs
@@ -1,7 +1,7 @@
-use std::{collections::HashMap, fs, ops::DerefMut};
+use std::{collections::HashMap, fs};
use harper_core::{Dictionary, Document, LintSet, Linter};
-use tokio::{sync::Mutex, time::Instant};
+use tokio::sync::Mutex;
use tower_lsp::{
jsonrpc::Result,
lsp_types::{
diff --git a/harper-ls/src/diagnostics.rs b/harper-ls/src/diagnostics.rs
index 80e35173a..ec27e9f38 100644
--- a/harper-ls/src/diagnostics.rs
+++ b/harper-ls/src/diagnostics.rs
@@ -1,8 +1,6 @@
-use harper_core::{Lint, Span, Suggestion};
+use harper_core::{Lint, Suggestion};
use std::collections::HashMap;
-use tower_lsp::lsp_types::{
- CodeAction, CodeActionKind, Diagnostic, Position, Range, TextEdit, Url, WorkspaceEdit,
-};
+use tower_lsp::lsp_types::{CodeAction, CodeActionKind, Diagnostic, TextEdit, Url, WorkspaceEdit};
use crate::pos_conv::span_to_range;