-
Notifications
You must be signed in to change notification settings - Fork 894
drop unindent and indoc dependencies
#5608
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
base: main
Are you sure you want to change the base?
Conversation
f6d37b2 to
536f879
Compare
|
Nice! We love dropping dependencies! Looks like this needs |
|
Ah it's possible to implement that by hand, will fixup later 👍 |
|
Red CI:
I think this is good to review / merge? |
|
unindent_bytes is a bit hard to read, but I think this all looks right. thanks! |
Tpt
left a comment
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 allowed myself a review. Nice to see dependencies being removed
| /// 3. If the first line is empty i.e. the string begins with a newline, remove the first line. | ||
| /// 4. Remove the computed number of spaces from the beginning of each line. | ||
| const fn unindent_bytes(bytes: &mut [u8]) -> usize { | ||
| if bytes.is_empty() { |
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.
nit: I think we can skip this special case but I might be wrong
| // line only had spaces, ignore for the count | ||
| if let Some(eol) = consume_eol(bytes, i) { | ||
| i = eol; | ||
| continue 'lines; |
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.
aside: 'lines is not useful here (not sure if you want to remove it or not)
| if value == b'\n' { | ||
| break; | ||
| } | ||
| } |
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.
nit: I think it's possible to factorize this loop into a function (it is repeated below) but not sure if it's welcome
With const eval getting more powerful, we're able to drop the
indocandunindentdependencies for thepy_run!macro.