-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Correctly handle string indices in literal_string_with_formatting_arg
#13841
Correctly handle string indices in literal_string_with_formatting_arg
#13841
Conversation
Failed to set assignee to
|
r? |
Ah funny, I thought it would reroll. Oh well. r? clippy |
current = ¤t[error.span.end + 1..]; | ||
let mut pos = 0; | ||
// We find the closest char to where the error location ends. | ||
for (char_pos, _) in current.char_indices() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My first thought was to use ceil_char_boundary
, also is_char_boundary
exists. Any reason to not use them?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't know they existed. :o
Thanks!
5f27365
to
ad695da
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
TIL about floor_char_boundary
.
Welcome to the club! \o/ |
Once again i avoided ?r, nice. Btw, this one was found while i run clippy over r-a, so expect more reports until rust sync. |
It's very welcome, thanks in advance! |
Fixes #13838.
r? @klensy
changelog: Correctly handle string indices in
literal_string_with_formatting_arg