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

A few cleanups and minor improvements to typeck/check #54533

Merged
merged 1 commit into from
Sep 27, 2018

Conversation

ljedrz
Copy link
Contributor

@ljedrz ljedrz commented Sep 24, 2018

  • turn a loop into a while let
  • turn a push_back loop into an extend
  • turn a few push loops into collected iterators
  • prefer vec![x; n] to (0..n).map(|_| x).collect()
  • combine two loops doing the same thing on 2 data sets using chain
  • use unwrap_or where applicable and readable
  • add a potentially_plural_count helper function to simplify several format!() calls
  • prefer to_owned to to_string for string literals
  • change match to if let where only one branch matters
  • a few other minor improvements
  • whitespace fixes

@rust-highfive
Copy link
Collaborator

r? @davidtwco

(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 Sep 24, 2018
@davidtwco

This comment has been minimized.

@bors

This comment has been minimized.

@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 Sep 24, 2018
@bors

This comment has been minimized.

@bors

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@bors bors added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 25, 2018
@ljedrz

This comment has been minimized.

@davidtwco

This comment has been minimized.

@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 Sep 25, 2018
@bors

This comment has been minimized.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 25, 2018
@ljedrz ljedrz force-pushed the cleanup_librustc_typeck_check branch from 809659b to db69d47 Compare September 26, 2018 08:05
@ljedrz

This comment has been minimized.

@rust-highfive

This comment has been minimized.

@ljedrz ljedrz force-pushed the cleanup_librustc_typeck_check branch from db69d47 to 3ed773a Compare September 26, 2018 09:00
@ljedrz

This comment has been minimized.

@davidtwco

This comment has been minimized.

@bors

This comment has been minimized.

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 26, 2018
@bors

This comment has been minimized.

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Sep 26, 2018
kennytm added a commit to kennytm/rust that referenced this pull request Sep 27, 2018
…davis

A few cleanups and minor improvements to typeck

This PR complements rust-lang#54533, which was limited to `check`.

- change a few `push` loops to `extend`s
- prefer `to_owned` to `to_string` for string literals
- prefer `if let` to `match` where only one branch matters
- a few other minor improvements
- whitespace fixes
@ljedrz ljedrz force-pushed the cleanup_librustc_typeck_check branch from 3ed773a to 3527276 Compare September 27, 2018 08:18
@ljedrz
Copy link
Contributor Author

ljedrz commented Sep 27, 2018

Rebased.

@davidtwco
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Sep 27, 2018

📌 Commit 3527276 has been approved by davidtwco

@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-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Sep 27, 2018
@bors
Copy link
Contributor

bors commented Sep 27, 2018

⌛ Testing commit 3527276 with merge f1694ea...

bors added a commit that referenced this pull request Sep 27, 2018
A few cleanups and minor improvements to typeck/check

- turn a `loop` into a `while let`
- turn a `push_back` loop into an `extend`
- turn a few `push` loops into collected iterators
- prefer `vec![x; n]` to `(0..n).map(|_| x).collect()`
- combine two loops doing the same thing on 2 data sets using `chain`
- use `unwrap_or` where applicable and readable
- add a `potentially_plural_count` helper function to simplify several `format!()` calls
- prefer `to_owned` to `to_string` for string literals
- change `match` to `if let` where only one branch matters
- a few other minor improvements
- whitespace fixes
@bors
Copy link
Contributor

bors commented Sep 27, 2018

☀️ Test successful - status-appveyor, status-travis
Approved by: davidtwco
Pushing f1694ea to master...

@bors bors merged commit 3527276 into rust-lang:master Sep 27, 2018
@ljedrz ljedrz deleted the cleanup_librustc_typeck_check branch September 27, 2018 20:50
bors added a commit that referenced this pull request Sep 29, 2018
A few cleanups and minor improvements to typeck

This PR complements #54533, which was limited to `check`.

- change a few `push` loops to `extend`s
- prefer `to_owned` to `to_string` for string literals
- prefer `if let` to `match` where only one branch matters
- a few other minor improvements
- whitespace fixes
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