File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
crates/zuban_python/tests/mypylike Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -445,14 +445,16 @@ impl TestCase<'_, '_> {
445445 s = s. replace ( "__main__.py:" , "__main__:" ) ;
446446 }
447447 if cfg ! ( target_os = "windows" ) {
448- // TODO this only checks the first line, but with notes there may
449- // be multiple lines.
450- let colon = s. find ( ":" ) . unwrap ( ) ;
451- let to_change = & mut s[ ..colon] ;
452448 // Safety: OK because we only modify ASCII
453- for b in unsafe { to_change. as_bytes_mut ( ) } {
454- if * b == b'\\' {
455- * b = b'/'
449+ let bytes = unsafe { s. as_bytes_mut ( ) } ;
450+ for line in bytes. split_mut ( |c| * c == b'\n' ) {
451+ if let Some ( colon) = line. iter ( ) . position ( |c| * c == b':' ) {
452+ let to_change = & mut line[ ..colon] ;
453+ for b in to_change {
454+ if * b == b'\\' {
455+ * b = b'/'
456+ }
457+ }
456458 }
457459 }
458460 }
You can’t perform that action at this time.
0 commit comments