Replace some matches with try.
This commit is contained in:
parent
76242aebb9
commit
ab72611d8f
3 changed files with 3 additions and 12 deletions
|
@ -285,10 +285,7 @@ impl<'a> base::Resolver for Resolver<'a> {
|
||||||
-> Result<Option<Rc<SyntaxExtension>>, Determinacy> {
|
-> Result<Option<Rc<SyntaxExtension>>, Determinacy> {
|
||||||
let def = match invoc.kind {
|
let def = match invoc.kind {
|
||||||
InvocationKind::Attr { attr: None, .. } => return Ok(None),
|
InvocationKind::Attr { attr: None, .. } => return Ok(None),
|
||||||
_ => match self.resolve_invoc_to_def(invoc, scope, force) {
|
_ => self.resolve_invoc_to_def(invoc, scope, force)?,
|
||||||
Ok(def) => def,
|
|
||||||
Err(determinacy) => return Err(determinacy),
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
self.macro_defs.insert(invoc.expansion_data.mark, def.def_id());
|
self.macro_defs.insert(invoc.expansion_data.mark, def.def_id());
|
||||||
|
|
|
@ -1249,10 +1249,7 @@ impl<'a> Parser<'a> {
|
||||||
let mac = respan(lo.to(self.prev_span), Mac_ { path: pth, tts: tts });
|
let mac = respan(lo.to(self.prev_span), Mac_ { path: pth, tts: tts });
|
||||||
(keywords::Invalid.ident(), ast::TraitItemKind::Macro(mac))
|
(keywords::Invalid.ident(), ast::TraitItemKind::Macro(mac))
|
||||||
} else {
|
} else {
|
||||||
let (constness, unsafety, abi) = match self.parse_fn_front_matter() {
|
let (constness, unsafety, abi) = self.parse_fn_front_matter()?;
|
||||||
Ok(cua) => cua,
|
|
||||||
Err(e) => return Err(e),
|
|
||||||
};
|
|
||||||
|
|
||||||
let ident = self.parse_ident()?;
|
let ident = self.parse_ident()?;
|
||||||
let mut generics = self.parse_generics()?;
|
let mut generics = self.parse_generics()?;
|
||||||
|
|
|
@ -211,10 +211,7 @@ impl<T: Encodable> Encodable for P<[T]> {
|
||||||
|
|
||||||
impl<T: Decodable> Decodable for P<[T]> {
|
impl<T: Decodable> Decodable for P<[T]> {
|
||||||
fn decode<D: Decoder>(d: &mut D) -> Result<P<[T]>, D::Error> {
|
fn decode<D: Decoder>(d: &mut D) -> Result<P<[T]>, D::Error> {
|
||||||
Ok(P::from_vec(match Decodable::decode(d) {
|
Ok(P::from_vec(Decodable::decode(d)?))
|
||||||
Ok(t) => t,
|
|
||||||
Err(e) => return Err(e)
|
|
||||||
}))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue