Skip to content

Replace option_try macros and match with ? operator #46602

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

Merged
merged 1 commit into from
Dec 10, 2017

Conversation

mbrubeck
Copy link
Contributor

@mbrubeck mbrubeck commented Dec 9, 2017

No description provided.

@kennytm kennytm added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 9, 2017
@kennytm
Copy link
Member

kennytm commented Dec 9, 2017

Could you also replace:

  • try_opt! macro in src/libsyntax_ext/format_foreign.rs and src/libstd/net/addr.rs,
  • The hand-written expansions in src/liballoc/allocator.rs
  • Everywhere-else appropriate where None => return None appears

Thanks!

@mbrubeck mbrubeck changed the title Replace option_try macro with ? operator Replace option_try macros and match with ? operator Dec 9, 2017
@mbrubeck
Copy link
Contributor Author

mbrubeck commented Dec 9, 2017

Updated to replace try_opt! and various manual match expressions. I'm sure there are more places where this could be used, but this covers the ones that were easily findable and relatively straightforward to replace.

Copy link
Member

@kennytm kennytm 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 after Travis is passing.

}
None => return None,
None => {
let &(ref fqp, shortty)) = cache.external_paths.get(&did)?;
Copy link
Member

Choose a reason for hiding this comment

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

There’s an extra ) here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

@frewsxcv
Copy link
Member

@bors r=kennytm

@bors
Copy link
Collaborator

bors commented Dec 10, 2017

📌 Commit 3024c14 has been approved by kennytm

@bors
Copy link
Collaborator

bors commented Dec 10, 2017

⌛ Testing commit 3024c14 with merge c89e206...

bors added a commit that referenced this pull request Dec 10, 2017
Replace option_try macros and match with ? operator

None
@bors
Copy link
Collaborator

bors commented Dec 10, 2017

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

@bors bors merged commit 3024c14 into rust-lang:master Dec 10, 2017
@leonardo-m
Copy link

A nice reduction of lines count.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-review Status: Awaiting review from the assignee but also interested parties.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants