fix: fix lint issues

上级 42f2e38c
......@@ -545,7 +545,8 @@ impl Grammar {
) {
let match_result =
self.match_rule(line_text, is_first_line, line_pos, stack, anchor_position);
if let Some(_result) = match_result {} else {
if let Some(_result) = match_result {
} else {
// None
};
// todo: get injections logic
......@@ -762,7 +763,6 @@ hellomake: $(OBJ)
debug_output(&grammar, String::from("program.json"));
}
#[test]
fn should_resolve_make_file_error_issues2() {
let code = "hellomake: $(OBJ)
......@@ -800,5 +800,4 @@ hellomake: $(OBJ)
}
grammar
}
}
......@@ -111,7 +111,5 @@ impl StackElement {
return self;
}
pub fn reset(&mut self) {
}
pub fn reset(&mut self) {}
}
......@@ -46,7 +46,5 @@ pub trait IRuleFactoryHelper: IGrammarRegistry + IRuleRegistry {}
#[cfg(test)]
mod tests {
#[test]
fn should_build_json_code() {
}
}
\ No newline at end of file
fn should_build_json_code() {}
}
......@@ -76,7 +76,7 @@ impl RegExpSourceList {
let compiled_rule = CompiledRule::new(reg_exps, rules);
self._cached = Some(compiled_rule.clone());
};
return self._cached.clone().unwrap()
return self._cached.clone().unwrap();
} else {
println!("// todo: cached {:?}", self._items);
}
......
......@@ -120,7 +120,7 @@ where
#[cfg(test)]
mod tests {
use crate::scanner::scanner::{str_vec_to_string, IOnigMatch, Scanner};
use crate::scanner::scanner::{str_vec_to_string, Scanner};
#[test]
fn should_handle_simple_regex() {
......@@ -320,7 +320,7 @@ mod tests {
"^(ifdef|ifndef)\\s*([^\\s]+)(?=\\s)",
"^(ifeq|ifneq)(?=\\s)]",
];
let rules = vec![2, 7, 28, 45, 48, 51, 61, 64, 66, 69, 77];
let _rules = vec![2, 7, 28, 45, 48, 51, 61, 64, 66, 69, 77];
let debug_regex = str_vec_to_string(origin);
let mut scanner = Scanner::new(debug_regex);
let result = scanner.find_next_match_sync(String::from("%.o: %.c $(DEPS)"), 0);
......@@ -330,7 +330,7 @@ mod tests {
#[test]
fn should_match_makefile_special_char() {
let origin = vec!["(?=\\s|$)", "(\\$?\\$)[@%<?^+*]", "\\$?\\$\\(", "%"];
let rules = vec![-1, 12, 14, 33];
let _rules = vec![-1, 12, 14, 33];
let debug_regex = str_vec_to_string(origin);
let mut scanner = Scanner::new(debug_regex);
let result = scanner.find_next_match_sync(String::from("%.o"), 0);
......@@ -343,11 +343,16 @@ mod tests {
#[test]
fn should_match_for_scope_target() {
let origin = vec!["^(?!\\t)", "\\G", "^\\t"];
let rules = vec![-1, 36, 39];
let _rules = vec![-1, 36, 39];
let debug_regex = str_vec_to_string(origin);
let mut scanner = Scanner::new(debug_regex);
let result = scanner.find_next_match_sync(String::from("%.o: %.c $(DEPS)
"), 4);
let result = scanner.find_next_match_sync(
String::from(
"%.o: %.c $(DEPS)
",
),
4,
);
let onig_match = result.unwrap();
assert_eq!(1, onig_match.index);
assert_eq!(4, onig_match.capture_indices[0].start);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册