Skip to content

Use char index rather than position for indent slice#11645

Merged
charliermarsh merged 1 commit intomainfrom
charlie/pos
May 31, 2024
Merged

Use char index rather than position for indent slice#11645
charliermarsh merged 1 commit intomainfrom
charlie/pos

Conversation

@charliermarsh
Copy link
Member

Summary

A beginner's mistake :)

Closes #11641.

@charliermarsh charliermarsh added the bug Something isn't working label May 31, 2024
@charliermarsh charliermarsh enabled auto-merge (squash) May 31, 2024 19:01
@charliermarsh charliermarsh merged commit f9a6450 into main May 31, 2024
@charliermarsh charliermarsh deleted the charlie/pos branch May 31, 2024 19:04
@github-actions
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

}
TokenKind::NonLogicalNewline => {
let line = locator.line(range.end());
let indent_index = line.chars().position(|c| !c.is_whitespace());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you could do line.find(|c| !c.is_whitespace())

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow TIL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rule A003 cause panic

2 participants