-
Notifications
You must be signed in to change notification settings - Fork 13k
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
more cleanups #69619
more cleanups #69619
Conversation
matthiaskrgr
commented
Mar 1, 2020
•
edited
Loading
edited
- use starts_with() instead of chars().next() == Some(x)
- use subsec_micros() instead of subsec_nanos() / 1000
- use for (idx, item) in iter.enumerate() instead of manually counting loop iterations with variables
- use values() or keys() respectively when iterating only over keys or values of maps.
r? @eddyb (rust_highfive has picked a reviewer for you, use r? to override) |
for (idx, local) in ineligible_locals.iter().enumerate() { | ||
assignments[local] = Ineligible(Some(idx as u32)); |
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.
for (_, item) in &krate.items { | ||
visitor.visit_item(item); | ||
} | ||
krate.items.values().for_each(|item| visitor.visit_item(item)) |
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 prefer avoiding for_each
as an anti-pattern, tbh, but the .values()
change seems fine.
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.
sure, I'll change it
tv_usec: (dur.subsec_nanos() / 1000) as libc::suseconds_t, | ||
tv_usec: dur.subsec_micros() as libc::suseconds_t, |
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.
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.
r=me modulo for_each
nit (I don't expect the cc's to require any changes)
@bors r+ |
📌 Commit 21affdd has been approved by |
Rollup of 9 pull requests Successful merges: - #69213 (Improve documentation on iterators length) - #69609 (Remove `usable_size` APIs) - #69619 (more cleanups) - #69620 (doc(librustc_error_codes): add long error explanation for E0719) - #69626 (Toolstate: don't duplicate nightly tool list.) - #69628 (Fix a leak in `DiagnosticBuilder::into_diagnostic`.) - #69633 (Update my mailmap entry) - #69634 (clean up E0378 explanation) - #69637 (Don't convert Results to Options just for matching.) Failed merges: r? @ghost