@@ -251,7 +251,7 @@ impl FileAnalyzer {
251251 if !self . is_in_string ( before, lang) {
252252 let after = & line[ pos + 3 ..] ;
253253 // Check if it closes on the same line
254- if after. find ( pattern) . is_none ( ) {
254+ if ! after. contains ( pattern) {
255255 // Docstring: no assignment before the triple quotes
256256 let is_docstring = !before. contains ( '=' ) ;
257257 return Some ( StringDelimiter {
@@ -341,7 +341,7 @@ impl FileAnalyzer {
341341
342342 // Check if it closes on the same line
343343 let after_quote = & line[ i + 1 ..] ;
344- if after_quote. find ( & end_pattern) . is_none ( ) {
344+ if ! after_quote. contains ( & end_pattern) {
345345 return Some ( StringDelimiter {
346346 end_pattern,
347347 is_raw : true ,
@@ -534,8 +534,14 @@ mod tests {
534534 let content = "let s = r#\" hello\n // not a comment\n /* also not */\n world\" #;\n " ;
535535 let stats = analyzer. count_lines ( content, & lang) ;
536536 assert_eq ! ( stats. total, 4 ) ;
537- assert_eq ! ( stats. code, 4 , "All lines should be code (inside raw string)" ) ;
538- assert_eq ! ( stats. comment, 0 , "No comments - everything is inside raw string" ) ;
537+ assert_eq ! (
538+ stats. code, 4 ,
539+ "All lines should be code (inside raw string)"
540+ ) ;
541+ assert_eq ! (
542+ stats. comment, 0 ,
543+ "No comments - everything is inside raw string"
544+ ) ;
539545 assert_eq ! ( stats. blank, 0 ) ;
540546 }
541547}
0 commit comments