about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJosh Stone <jistone@redhat.com>2020-08-01 11:41:59 -0700
committerJosh Stone <jistone@redhat.com>2020-08-01 11:41:59 -0700
commit66a02ec2d6d8c2f0394be18b9a5011acccc4ba9a (patch)
tree09d97f8509a3cff2127c54fbd1206df292b5602e
parentcfdf9d335501cc0a53ae69c940095cca7d4be0f8 (diff)
downloadrust-66a02ec2d6d8c2f0394be18b9a5011acccc4ba9a.tar.gz
rust-66a02ec2d6d8c2f0394be18b9a5011acccc4ba9a.zip
Use a slice pattern instead of rchunks_exact(_).next()
This is a minor cleanup, but trying a single-use `rchunks` iterator can
be more directly matched with a slice pattern, `[.., a, b]`.
-rw-r--r--src/librustc_privacy/lib.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/librustc_privacy/lib.rs b/src/librustc_privacy/lib.rs
index 9c5fb4ce734..fc00050f405 100644
--- a/src/librustc_privacy/lib.rs
+++ b/src/librustc_privacy/lib.rs
@@ -637,7 +637,7 @@ impl EmbargoVisitor<'tcx> {
         &mut self,
         segments: &[hir::PathSegment<'_>],
     ) {
-        if let Some([module, segment]) = segments.rchunks_exact(2).next() {
+        if let [.., module, segment] = segments {
             if let Some(item) = module
                 .res
                 .and_then(|res| res.mod_def_id())