From f979d8dbc36534802e1f36e98ed5a639053164ac Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Thu, 10 Nov 2022 15:39:31 +0900 Subject: [PATCH] Apply let-else statements --- parser/build.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/parser/build.rs b/parser/build.rs index 81c28f4..4559f26 100644 --- a/parser/build.rs +++ b/parser/build.rs @@ -17,9 +17,7 @@ fn main() -> anyhow::Result<()> { } fn requires_lalrpop(source: &str, target: &str) -> Option { - let target = if let Ok(target) = File::open(target) { - target - } else { + let Ok(target) = File::open(target) else { return Some("python.rs doesn't exist. regenerate.".to_owned()); }; @@ -71,9 +69,7 @@ fn requires_lalrpop(source: &str, target: &str) -> Option { } fn try_lalrpop(source: &str, target: &str) -> anyhow::Result<()> { - let _message = if let Some(msg) = requires_lalrpop(source, target) { - msg - } else { + let Some(_message) = requires_lalrpop(source, target) else { return Ok(()); };