Skip to content

Commit

Permalink
Clear clippy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
evanrittenhouse committed Apr 1, 2023
1 parent 78078f3 commit 74eb245
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions crates/ruff/src/checkers/physical_lines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ pub fn check_physical_lines(
let mut commented_lines_iter = commented_lines.iter().peekable();
let mut doc_lines_iter = doc_lines.iter().peekable();
let mut in_quote = false;
let _quote_block_delimiter: Option<&str> = None;

for (index, line) in locator.contents().universal_newlines().enumerate() {
while commented_lines_iter
Expand Down Expand Up @@ -200,14 +199,18 @@ pub fn check_physical_lines(

/// Finds the first delimiter which occurs on a line, and returns both the delimiter and how many
/// times it appears
fn find_delimiter(line: &str) -> (Option<&str>, i32) {
fn find_delimiter(line: &str) -> (Option<&str>, i64) {
let delimiters = vec!["\"\"\"", "'''"];

let mut delimiter_string = None;
let mut delimiter_count = 0;
for delimiter in delimiters {
if line.contains(delimiter) {
delimiter_count = line.matches(delimiter).count() as i32;
// If something went wrong while parsing, the most common case is one triple-quote occurrence on a
// single line
delimiter_count = i64::try_from(line.matches(delimiter).count())
.ok()
.unwrap_or(1i64);
delimiter_string = Some(delimiter);
}
}
Expand Down

0 comments on commit 74eb245

Please sign in to comment.