diff options
| author | bors <bors@rust-lang.org> | 2020-01-09 02:05:15 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-01-09 02:05:15 +0000 |
| commit | adc65725004c8aac16392fe4052c3e347181157d (patch) | |
| tree | 01f6119b01516f50953d5b4a1f3cfdb44bf6742a /src/libstd | |
| parent | caa231d998a5e853c7ba1455d7a05b500df9d63c (diff) | |
| parent | b24de8f0f861781cd83018ad43d7aa9dd2cb55bb (diff) | |
| download | rust-adc65725004c8aac16392fe4052c3e347181157d.tar.gz rust-adc65725004c8aac16392fe4052c3e347181157d.zip | |
Auto merge of #68034 - Centril:rollup-3d9pq14, r=Centril
Rollup of 12 pull requests Successful merges: - #67630 (Treat extern statics just like statics in the "const pointer to static" representation) - #67747 (Explain that associated types and consts can't be accessed directly on the trait's path) - #67884 (Fix incremental builds of core by allowing unused attribute.) - #67966 (Use matches macro in libcore and libstd) - #67979 (Move `intravisit` => `rustc_hir` + misc cleanup) - #67986 (Display more informative ICE) - #67990 (slice patterns: harden match-based borrowck tests) - #68005 (Improve E0184 explanation) - #68009 (Spell check librustc_error_codes) - #68023 (Fix issue #68008) - #68024 (Remove `-Z continue-parse-after-error`) - #68026 (Small improvements in lexical_region_resolve) Failed merges: r? @ghost
Diffstat (limited to 'src/libstd')
| -rw-r--r-- | src/libstd/net/addr.rs | 10 | ||||
| -rw-r--r-- | src/libstd/net/ip.rs | 10 | ||||
| -rw-r--r-- | src/libstd/path.rs | 10 | ||||
| -rw-r--r-- | src/libstd/sync/barrier.rs | 5 | ||||
| -rw-r--r-- | src/libstd/sync/mpsc/oneshot.rs | 7 |
5 files changed, 8 insertions, 34 deletions
diff --git a/src/libstd/net/addr.rs b/src/libstd/net/addr.rs index a9d88370c61..a59d7f0263b 100644 --- a/src/libstd/net/addr.rs +++ b/src/libstd/net/addr.rs @@ -227,10 +227,7 @@ impl SocketAddr { /// ``` #[stable(feature = "sockaddr_checker", since = "1.16.0")] pub fn is_ipv4(&self) -> bool { - match *self { - SocketAddr::V4(_) => true, - SocketAddr::V6(_) => false, - } + matches!(*self, SocketAddr::V4(_)) } /// Returns [`true`] if the [IP address] in this `SocketAddr` is an @@ -252,10 +249,7 @@ impl SocketAddr { /// ``` #[stable(feature = "sockaddr_checker", since = "1.16.0")] pub fn is_ipv6(&self) -> bool { - match *self { - SocketAddr::V4(_) => false, - SocketAddr::V6(_) => true, - } + matches!(*self, SocketAddr::V6(_)) } } diff --git a/src/libstd/net/ip.rs b/src/libstd/net/ip.rs index 15d2361acd9..6410a4f2b65 100644 --- a/src/libstd/net/ip.rs +++ b/src/libstd/net/ip.rs @@ -281,10 +281,7 @@ impl IpAddr { /// ``` #[stable(feature = "ipaddr_checker", since = "1.16.0")] pub fn is_ipv4(&self) -> bool { - match self { - IpAddr::V4(_) => true, - IpAddr::V6(_) => false, - } + matches!(self, IpAddr::V4(_)) } /// Returns [`true`] if this address is an [IPv6 address], and [`false`] otherwise. @@ -303,10 +300,7 @@ impl IpAddr { /// ``` #[stable(feature = "ipaddr_checker", since = "1.16.0")] pub fn is_ipv6(&self) -> bool { - match self { - IpAddr::V4(_) => false, - IpAddr::V6(_) => true, - } + matches!(self, IpAddr::V6(_)) } } diff --git a/src/libstd/path.rs b/src/libstd/path.rs index f308d511cf8..fbbdc1ddac2 100644 --- a/src/libstd/path.rs +++ b/src/libstd/path.rs @@ -224,18 +224,12 @@ impl<'a> Prefix<'a> { #[stable(feature = "rust1", since = "1.0.0")] pub fn is_verbatim(&self) -> bool { use self::Prefix::*; - match *self { - Verbatim(_) | VerbatimDisk(_) | VerbatimUNC(..) => true, - _ => false, - } + matches!(*self, Verbatim(_) | VerbatimDisk(_) | VerbatimUNC(..)) } #[inline] fn is_drive(&self) -> bool { - match *self { - Prefix::Disk(_) => true, - _ => false, - } + matches!(*self, Prefix::Disk(_)) } #[inline] diff --git a/src/libstd/sync/barrier.rs b/src/libstd/sync/barrier.rs index eddbdff257a..01314370ce3 100644 --- a/src/libstd/sync/barrier.rs +++ b/src/libstd/sync/barrier.rs @@ -199,10 +199,7 @@ mod tests { // At this point, all spawned threads should be blocked, // so we shouldn't get anything from the port - assert!(match rx.try_recv() { - Err(TryRecvError::Empty) => true, - _ => false, - }); + assert!(matches!(rx.try_recv(), Err(TryRecvError::Empty))); let mut leader_found = barrier.wait().is_leader(); diff --git a/src/libstd/sync/mpsc/oneshot.rs b/src/libstd/sync/mpsc/oneshot.rs index bbe77e7d0fb..5b41525e06a 100644 --- a/src/libstd/sync/mpsc/oneshot.rs +++ b/src/libstd/sync/mpsc/oneshot.rs @@ -118,12 +118,7 @@ impl<T> Packet<T> { // Just tests whether this channel has been sent on or not, this is only // safe to use from the sender. pub fn sent(&self) -> bool { - unsafe { - match *self.upgrade.get() { - NothingSent => false, - _ => true, - } - } + unsafe { !matches!(*self.upgrade.get(), NothingSent) } } pub fn recv(&self, deadline: Option<Instant>) -> Result<T, Failure<T>> { |
