diff options
| author | Corey Farwell <coreyf@rwell.org> | 2017-06-07 21:58:45 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-06-07 21:58:45 -0400 |
| commit | aa536f4be3f420beb0080c1f73a90934a689bf87 (patch) | |
| tree | 299c1950b0bb6690c78f62883ff11e3971b173e7 /src/libsyntax | |
| parent | 3ce88c7c8d3a422146bdc749c4e0207517b1f92a (diff) | |
| parent | ab72611d8f664684dbd5dd2efe6fd7edff53ee5d (diff) | |
| download | rust-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.rs | 5 | ||||
| -rw-r--r-- | src/libsyntax/ptr.rs | 5 |
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)?)) } } |
