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

more cleanups #69619

Merged
merged 4 commits into from
Mar 3, 2020
Merged

more cleanups #69619

merged 4 commits into from
Mar 3, 2020

Conversation

matthiaskrgr
Copy link
Member

@matthiaskrgr matthiaskrgr commented Mar 1, 2020

  • 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.

@rust-highfive
Copy link
Collaborator

r? @eddyb

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Mar 1, 2020
Comment on lines +1385 to +1386
for (idx, local) in ineligible_locals.iter().enumerate() {
assignments[local] = Ineligible(Some(idx as u32));
Copy link
Member

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))
Copy link
Member

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.

Copy link
Member Author

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,
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Member

@eddyb eddyb left a 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)

@eddyb
Copy link
Member

eddyb commented Mar 2, 2020

@bors r+

@bors
Copy link
Contributor

bors commented Mar 2, 2020

📌 Commit 21affdd has been approved by eddyb

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Mar 2, 2020
bors added a commit that referenced this pull request Mar 3, 2020
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
@bors bors merged commit f19684c into rust-lang:master Mar 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants