Simplify arithmetic operation in logical lines checker#11346
Simplify arithmetic operation in logical lines checker#11346charliermarsh merged 1 commit intoastral-sh:mainfrom
Conversation
|
zanieb
left a comment
There was a problem hiding this comment.
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? |
| 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.
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.
I.e., is the goal here perhaps that indent ends up as a multiple of tab_size?
There was a problem hiding this comment.
Is the deal here that there's implicit integer rounding?
There was a problem hiding this comment.
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