-
-
Notifications
You must be signed in to change notification settings - Fork 314
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
base: master
Are you sure you want to change the base?
Clean variable cache #2441
Conversation
@@ -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)] |
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.
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); |
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.
🤯
.clipping(threshold, &mut remainder) | ||
.collect(); | ||
assert_eq!(result, expected); | ||
assert_eq!(remainder, input.len() - expected.len()); |
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.
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)
.
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.
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 :)
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 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 :)
No description provided.