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

Clean variable cache #2441

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

Clean variable cache #2441

wants to merge 2 commits into from

Conversation

Yatekii
Copy link
Member

@Yatekii Yatekii commented May 9, 2024

No description provided.

@@ -42,6 +42,7 @@ mod register {
memory_mapped_bitfield_register! {
/// B3.2.3 CPUID Base Register
#[allow(non_camel_case_types)]
#[allow(clippy::upper_case_acronyms)]
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe we should make these allows part of the macro?

$(#[$outer])*
#[doc= concat!("A [`bitfield::bitfield!`] register mapping for the register `", $reg_name, "` located at address `", stringify!($addr), "`.")]
#[derive(Copy, Clone)]
($vis_modifier) struct $struct_name($reg_type);
Copy link
Contributor

Choose a reason for hiding this comment

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

🤯

.clipping(threshold, &mut remainder)
.collect();
assert_eq!(result, expected);
assert_eq!(remainder, input.len() - expected.len());
Copy link
Contributor

Choose a reason for hiding this comment

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

This makes very little sense to me. If we intend the iterator to be collected, why does it count the remainder? And if it's not intended to be collected, why do we show this as the example?

I guess I'd not actually implement this functionality as an iterator, but instead a function that takes an iterator and returns (Vec<T>, usize).

Copy link
Member Author

Choose a reason for hiding this comment

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

This was just a nerdout to try and make it work and I had to stash that work :D
I will go the function route with a Vec :)

Copy link
Contributor

Choose a reason for hiding this comment

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

I also understand the allure of going overboard and I think "slapping on each others' hands" might not be a bad idea to avoid overcomplicating what doesn't need to be :)

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.

None yet

2 participants