-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Simplify arithmetic operation in logical lines checker #11346
Simplify arithmetic operation in logical lines checker #11346
Conversation
|
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.
Huh. It'd be good to get the eyes of the original author on this too.
Yeah that's interesting, hmm... Maybe it evolved over time? Maybe this was just the way they thought about the logic? |
@@ -24,7 +24,7 @@ pub(crate) fn expand_indent(line: &str, indent_width: IndentWidth) -> usize { | |||
let tab_size = indent_width.as_usize(); | |||
for c in line.bytes() { | |||
match c { | |||
b'\t' => indent = (indent / tab_size) * tab_size + tab_size, |
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.
Wait sorry, is this the same? What if indent
is 4 and tab_size
is 3?
indent += tab_size
would yield 7, but indent = (indent / tab_size) * tab_size + tab_size
would yield 6, right?
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.e., is the goal here perhaps that indent
ends up as a multiple of tab_size
?
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.
Is the deal here that there's implicit integer rounding?
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.
If so, can we add a comment explaining the deal? @charliermarsh
This reverts commit e9d1cdd.
…" (#11348) ## Summary I merged this, but I think it might not be the same behavior? See my comment at: #11346 (comment)
## Summary Simplify arithmetic operation in logical lines checker
…" (#11348) ## Summary I merged this, but I think it might not be the same behavior? See my comment at: #11346 (comment)
Summary
Simplify arithmetic operation in logical lines checker