Skip to content
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

Fix/Extra whitespace in nested pub extern #5529

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

jmj0502
Copy link
Contributor

@jmj0502 jmj0502 commented Sep 2, 2022

Solves #5525

  • Now extra whitespace is removed from the beginning of the rhs expression on the rewrite_assign_rhs_with function (expr.rs - 1977) if the lhs expression ends with whitespace and the rhs expressions starts with whitespace. NOTE: The change only applies if the version: Two config is provided.

…to the flow of the rewrite_assign_rhs_expr function.
…s_with function (expr.rs - 1977) if the lhs expression ends with whitespace and the rhs expressions starts with whitespace.
@jmj0502 jmj0502 marked this pull request as ready for review September 19, 2022 14:15
@jmj0502
Copy link
Contributor Author

jmj0502 commented Sep 19, 2022

@ytmimi Noticed that integration / log (pull_request) failed while trying to download a resource; seems unrelated to code tho' (feel free to correct me if I'm wrong). Is there a way to re-run such action?

@ytmimi
Copy link
Contributor

ytmimi commented Sep 19, 2022

Seems like a networking issue. No worries, I just reran that job.

Comment on lines +1987 to +1989
if context.config.version() == Version::Two && lhs.ends_with(" ") && rhs.starts_with(" ") {
return Some(lhs + &rhs.trim_start());
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Although this technically fixes the issue, it doesn't resolve the underlying problem. I believe the trailing space is properly added to the end of "pub extern ", but we shouldn't be adding a space before "C". I think the actual issue is occurring in choose_rhs. @calebcartwright Do you think this is the right approach?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okok. This approach also handles other similar cases. However, it there's a better approach I'm up to take it. I'll wait for confirmation before making any changes to choose_rhs 👍.

second_long_argument_name: u32,
third_long_argument_name: u32,
),
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're just testing that the input is idempotent then we don't need the source/ test file.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, mb. I'll fix this now.

Copy link
Contributor

@ytmimi ytmimi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking this on. Right now I'd suggest holding off on making any changes to the PR until @calebcartwright has had a chance to review. the choose_rhs code path is fairly hot so we probably want to be cautious about the code changes we make there to address this issue.

@ytmimi ytmimi linked an issue Oct 19, 2022 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Extra whitespace in nested pub extern
2 participants