about summary refs log tree commit diff
path: root/src/libsyntax
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2017-06-07 21:58:45 -0400
committerGitHub <noreply@github.com>2017-06-07 21:58:45 -0400
commitaa536f4be3f420beb0080c1f73a90934a689bf87 (patch)
tree299c1950b0bb6690c78f62883ff11e3971b173e7 /src/libsyntax
parent3ce88c7c8d3a422146bdc749c4e0207517b1f92a (diff)
parentab72611d8f664684dbd5dd2efe6fd7edff53ee5d (diff)
downloadrust-aa536f4be3f420beb0080c1f73a90934a689bf87.tar.gz
rust-aa536f4be3f420beb0080c1f73a90934a689bf87.zip
Rollup merge of #42497 - qnighy:just-use-try-in-three-places, r=eddyb
Replace some matches with try.

This patch just replaces `match`es with `?` in the compiler, which I came across when I'm reading the parser.
Diffstat (limited to 'src/libsyntax')
-rw-r--r--src/libsyntax/parse/parser.rs5
-rw-r--r--src/libsyntax/ptr.rs5
2 files changed, 2 insertions, 8 deletions
diff --git a/src/libsyntax/parse/parser.rs b/src/libsyntax/parse/parser.rs
index d9cb2b4ab7d..1e156ed07b0 100644
--- a/src/libsyntax/parse/parser.rs
+++ b/src/libsyntax/parse/parser.rs
@@ -1249,10 +1249,7 @@ impl<'a> Parser<'a> {
             let mac = respan(lo.to(self.prev_span), Mac_ { path: pth, tts: tts });
             (keywords::Invalid.ident(), ast::TraitItemKind::Macro(mac))
         } else {
-            let (constness, unsafety, abi) = match self.parse_fn_front_matter() {
-                Ok(cua) => cua,
-                Err(e) => return Err(e),
-            };
+            let (constness, unsafety, abi) = self.parse_fn_front_matter()?;
 
             let ident = self.parse_ident()?;
             let mut generics = self.parse_generics()?;
diff --git a/src/libsyntax/ptr.rs b/src/libsyntax/ptr.rs
index 15111bbba0a..d51ff9860ac 100644
--- a/src/libsyntax/ptr.rs
+++ b/src/libsyntax/ptr.rs
@@ -211,10 +211,7 @@ impl<T: Encodable> Encodable for P<[T]> {
 
 impl<T: Decodable> Decodable for P<[T]> {
     fn decode<D: Decoder>(d: &mut D) -> Result<P<[T]>, D::Error> {
-        Ok(P::from_vec(match Decodable::decode(d) {
-            Ok(t) => t,
-            Err(e) => return Err(e)
-        }))
+        Ok(P::from_vec(Decodable::decode(d)?))
     }
 }