Skip to content

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

style(#160): remove outdated comments in CollapseIdentifiers and move is_case_seperator comment to tokens.rs

Grant Lemons498a38f5e8d2
diff --git a/harper-core/src/parsers/collapse_identifiers.rs b/harper-core/src/parsers/collapse_identifiers.rs
index 05ef63620..cc36774df 100644
--- a/harper-core/src/parsers/collapse_identifiers.rs
+++ b/harper-core/src/parsers/collapse_identifiers.rs
@@ -32,13 +32,9 @@ thread_local! {
}
impl Parser for CollapseIdentifiers {
- /// This implementation is quite gross to look at, but it works.
- /// If any issues arise, it would likely help to refactor this out first.
fn parse(&mut self, source: &[char]) -> Vec<Token> {
let mut tokens = self.inner.parse(source);
- // TODO: change is_case_separator to is_underscore and is_hyphen
-
let mut removal_indexes: VecDeque<usize> = VecDeque::default();
let replacements = WORD_OR_NUMBER
.with(|v| v.clone())
diff --git a/harper-core/src/token.rs b/harper-core/src/token.rs
index 59b5c9117..712d537c7 100644
--- a/harper-core/src/token.rs
+++ b/harper-core/src/token.rs
@@ -242,6 +242,9 @@ impl TokenKind {
matches!(self, TokenKind::Punctuation(Punctuation::At))
}
+ /// Used by `crate::parsers::CollapseIdentifiers`
+ /// TODO: Separate this into two functions and add OR functionality to
+ /// pattern matching
pub fn is_case_separator(&self) -> bool {
matches!(self, TokenKind::Punctuation(Punctuation::Underscore))
|| matches!(self, TokenKind::Punctuation(Punctuation::Hyphen))