Skip to content

Refactor macro-by-example code #13232

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

Merged
merged 6 commits into from
Sep 14, 2022
Merged

Refactor macro-by-example code #13232

merged 6 commits into from
Sep 14, 2022

Conversation

jplatte
Copy link
Contributor

@jplatte jplatte commented Sep 14, 2022

I had a look at the MBE code because of #7857. I found some easy readability wins, that might also marginally improve perf.

@@ -402,7 +393,7 @@ fn match_loop_inner<'t>(

// Check if we need a separator.
// We check the separator one by one
let sep_idx = *item.sep_parsed.as_ref().unwrap_or(&0);
let sep_idx = item.sep_parsed.unwrap_or(0);
let sep_len = item.sep.as_ref().map_or(0, Separator::tt_count);
if item.sep.is_some() && sep_idx != sep_len {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I also tried converting this to an if let, but for some reason it breaks the benchmark.

@Veykril
Copy link
Member

Veykril commented Sep 14, 2022

Thanks!
@bors r+

@bors
Copy link
Contributor

bors commented Sep 14, 2022

📌 Commit c4a87ee has been approved by Veykril

It is now in the queue for this repository.

@bors
Copy link
Contributor

bors commented Sep 14, 2022

⌛ Testing commit c4a87ee with merge 2b61be2...

@bors
Copy link
Contributor

bors commented Sep 14, 2022

☀️ Test successful - checks-actions
Approved by: Veykril
Pushing 2b61be2 to master...

@bors bors merged commit 2b61be2 into rust-lang:master Sep 14, 2022
@jplatte jplatte deleted the mbe-refactor branch September 15, 2022 07:19
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