From 73d4c59937a6872b799f08d5d65babd9e7d91ded Mon Sep 17 00:00:00 2001 From: Evan Rittenhouse Date: Sat, 8 Apr 2023 21:56:17 -0500 Subject: [PATCH] Clear clippy errors --- crates/ruff/src/rules/flake8_todo/rules.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/crates/ruff/src/rules/flake8_todo/rules.rs b/crates/ruff/src/rules/flake8_todo/rules.rs index 0b887ec3b5f53e..ff50e95aff874c 100644 --- a/crates/ruff/src/rules/flake8_todo/rules.rs +++ b/crates/ruff/src/rules/flake8_todo/rules.rs @@ -112,18 +112,18 @@ pub fn check_rules(tokens: &[LexResult]) -> Vec { }; if get_captured_matches(comment).peek().is_some() { - diagnostics.extend(get_tag_regex_errors(comment, start, end)); + diagnostics.extend(get_tag_regex_errors(comment, *start, *end)); } } diagnostics } -fn get_captured_matches(text: &String) -> Peekable { +fn get_captured_matches(text: &str) -> Peekable { TODO_REGEX.captures_iter(text).peekable() } -fn get_tag_regex_errors(text: &String, start: &Location, end: &Location) -> Vec { +fn get_tag_regex_errors(text: &str, start: Location, end: Location) -> Vec { let mut diagnostics: Vec = vec![]; for capture in TODO_REGEX.captures_iter(text) { @@ -134,7 +134,7 @@ fn get_tag_regex_errors(text: &String, start: &Location, end: &Location) -> Vec< InvalidTODOTag { tag: String::from(tag), }, - Range::new(*start, *end), + Range::new(start, end), )); // TODO: T006 check can go here @@ -143,9 +143,9 @@ fn get_tag_regex_errors(text: &String, start: &Location, end: &Location) -> Vec< // Note: This initially looks bad from a speed perspective, but is O(1) given that we // know that there will only ever be 1 `capture` (due to regex anchors) and constant // capture groups. - for capture_group_index in 2..NUM_CAPTURE_GROUPS + 1 { + for capture_group_index in 2..=NUM_CAPTURE_GROUPS { if capture.get(capture_group_index).is_none() { - let range = Range::new(*start, *end); + let range = Range::new(start, end); diagnostics.push(match capture_group_index { 2usize => Diagnostic::new(TODOMissingAuthor, range), 3usize => Diagnostic::new(TODOMissingColon, range),