diff --git a/src/modules/function/declaration.rs b/src/modules/function/declaration.rs index 00e2508c..7210d846 100644 --- a/src/modules/function/declaration.rs +++ b/src/modules/function/declaration.rs @@ -217,7 +217,7 @@ impl SyntaxModule for FunctionDeclaration { // Parse the body token(meta, "{")?; let (index_begin, index_end, is_failable) = skip_function_body(meta, declared_failable, &returns_tok)?; - if (!is_failable) && declared_failable { + if !is_failable && declared_failable { return error!(meta, returns_tok, "Infallible functions must not have a '?' after the type name"); } // Create a new context with the function body diff --git a/src/modules/function/declaration_utils.rs b/src/modules/function/declaration_utils.rs index ca9c8107..d912a4ff 100644 --- a/src/modules/function/declaration_utils.rs +++ b/src/modules/function/declaration_utils.rs @@ -6,7 +6,11 @@ use crate::utils::cc_flags::{CCFlags, get_ccflag_name}; use crate::utils::context::Context; use crate::utils::function_interface::FunctionInterface; -pub fn skip_function_body(meta: &mut ParserMetadata, declared_failable: bool, returns_tok: &Option) -> Result<(usize, usize, bool), Failure> { +pub fn skip_function_body( + meta: &mut ParserMetadata, + declared_failable: bool, + returns_tok: &Option +) -> Result<(usize, usize, bool), Failure> { let index_begin = meta.get_index(); let mut is_failable = false; let mut scope = 1; diff --git a/src/modules/function/invocation.rs b/src/modules/function/invocation.rs index 64bc6cb4..4f88251a 100644 --- a/src/modules/function/invocation.rs +++ b/src/modules/function/invocation.rs @@ -101,7 +101,7 @@ impl SyntaxModule for FunctionInvocation { self.is_failable = function_unit.is_failable; if self.is_failable { match syntax(meta, &mut self.failed) { - Ok(_) => {}, + Ok(_) => (), Err(Failure::Quiet(_)) => return error!(meta, tok => { message: "This function can fail. Please handle the failure", comment: "You can use '?' in the end to propagate the failure"