Skip to content

Conversation

@davidhewitt
Copy link
Member

With const eval getting more powerful, we're able to drop the indoc and unindent dependencies for the py_run! macro.

@alex
Copy link
Contributor

alex commented Nov 7, 2025

Nice! We love dropping dependencies! Looks like this needs copy_from_slice (const-MSRV 1.87.0)?

@davidhewitt
Copy link
Member Author

Ah it's possible to implement that by hand, will fixup later 👍

@davidhewitt davidhewitt marked this pull request as ready for review November 8, 2025 18:01
@davidhewitt
Copy link
Member Author

Red CI:

I think this is good to review / merge?

@alex
Copy link
Contributor

alex commented Nov 9, 2025

unindent_bytes is a bit hard to read, but I think this all looks right. thanks!

Copy link
Contributor

@Tpt Tpt left a 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() {
Copy link
Contributor

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;
Copy link
Contributor

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;
}
}
Copy link
Contributor

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

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants