parser: remove unneccessary wrapping of return value in parse_extern()

This commit is contained in:
Matthias Krüger 2021-02-21 13:06:00 +01:00
parent 00bc134e43
commit 85bd00fd85
2 changed files with 3 additions and 7 deletions

View File

@ -1679,7 +1679,7 @@ impl<'a> Parser<'a> {
let constness = self.parse_constness();
let asyncness = self.parse_asyncness();
let unsafety = self.parse_unsafety();
let ext = self.parse_extern()?;
let ext = self.parse_extern();
if let Async::Yes { span, .. } = asyncness {
self.ban_async_in_2015(span);

View File

@ -1202,12 +1202,8 @@ impl<'a> Parser<'a> {
}
/// Parses `extern string_literal?`.
fn parse_extern(&mut self) -> PResult<'a, Extern> {
Ok(if self.eat_keyword(kw::Extern) {
Extern::from_abi(self.parse_abi())
} else {
Extern::None
})
fn parse_extern(&mut self) -> Extern {
if self.eat_keyword(kw::Extern) { Extern::from_abi(self.parse_abi()) } else { Extern::None }
}
/// Parses a string literal as an ABI spec.