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

Don't convert Results to Options just for matching. #69637

Merged
merged 1 commit into from
Mar 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/librustc_resolve/imports.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1252,7 +1252,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
// this may resolve to either a value or a type, but for documentation
// purposes it's good enough to just favor one over the other.
self.r.per_ns(|this, ns| {
if let Some(binding) = source_bindings[ns].get().ok() {
if let Ok(binding) = source_bindings[ns].get() {
this.import_res_map.entry(directive.id).or_default()[ns] = Some(binding.res());
}
});
Expand Down Expand Up @@ -1293,7 +1293,7 @@ impl<'a, 'b> ImportResolver<'a, 'b> {
let mut redundant_span = PerNS { value_ns: None, type_ns: None, macro_ns: None };

self.r.per_ns(|this, ns| {
if let Some(binding) = source_bindings[ns].get().ok() {
if let Ok(binding) = source_bindings[ns].get() {
if binding.res() == Res::Err {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion src/libstd/net/addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ impl ToSocketAddrs for str {
type Iter = vec::IntoIter<SocketAddr>;
fn to_socket_addrs(&self) -> io::Result<vec::IntoIter<SocketAddr>> {
// try to parse as a regular SocketAddr first
if let Some(addr) = self.parse().ok() {
if let Ok(addr) = self.parse() {
return Ok(vec![addr].into_iter());
}

Expand Down