mirror of
https://github.com/danbulant/oxc
synced 2026-05-19 12:19:15 +00:00
refactor(oxc): ban index methods on std::str::Chars (#6075)
closes #6071
This commit is contained in:
parent
c5deb3235e
commit
f70e93b2f5
2 changed files with 11 additions and 2 deletions
9
.github/workflows/ci.yml
vendored
9
.github/workflows/ci.yml
vendored
|
|
@ -178,7 +178,16 @@ jobs:
|
|||
with:
|
||||
cache-key: warm
|
||||
components: clippy
|
||||
tools: ast-grep
|
||||
- run: cargo lint -- -D warnings
|
||||
- name: Check Char and Byte Offset
|
||||
run: |
|
||||
output=$(sg -p '$A.chars().enumerate()' -r '$A.char_indices()' -l rs)
|
||||
echo "Output: $output"
|
||||
if [ -n "$output" ]; then
|
||||
echo "Error: Unexpected output detected"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
doc:
|
||||
name: Doc
|
||||
|
|
|
|||
|
|
@ -133,9 +133,9 @@ fn min_distance(a: &str, b: &str) -> usize {
|
|||
|
||||
let mut previous_row: Vec<usize> = (0..=n).collect();
|
||||
|
||||
for (i, s1) in a.chars().enumerate() {
|
||||
for (i, s1) in a.char_indices() {
|
||||
let mut current_row = vec![i + 1];
|
||||
for (j, s2) in b.chars().enumerate() {
|
||||
for (j, s2) in b.char_indices() {
|
||||
let insertions = previous_row[j + 1] + 1;
|
||||
let deletions = current_row[j] + 1;
|
||||
let substitutions = previous_row[j] + usize::from(s1 != s2);
|
||||
|
|
|
|||
Loading…
Reference in a new issue