From 0a8efb033c2319b975126e3924897c42c6d5d0de Mon Sep 17 00:00:00 2001 From: Eddy Filip Date: Mon, 20 Jan 2025 15:59:40 +0100 Subject: [PATCH] Improve code --- core/src/language/go.rs | 2 +- core/src/parser.rs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/core/src/language/go.rs b/core/src/language/go.rs index 99811424..a5d6a6bb 100644 --- a/core/src/language/go.rs +++ b/core/src/language/go.rs @@ -200,7 +200,7 @@ impl Language for Go { .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?; writeln!( w, - "const {} {} = {};", + "const {} {} = {}", c.id.renamed.to_pascal_case(), const_type, val diff --git a/core/src/parser.rs b/core/src/parser.rs index c2832f1e..53b9ed5d 100644 --- a/core/src/parser.rs +++ b/core/src/parser.rs @@ -528,7 +528,8 @@ pub(crate) fn parse_const(c: &ItemConst) -> Result { | RustType::Special(SpecialRustType::Option(_)) => { return Err(ParseError::RustConstTypeInvalid); } - RustType::Special(_s) => (), + RustType::Special(_) => (), + RustType::Simple { .. } => (), _ => return Err(ParseError::RustConstTypeInvalid), }; @@ -567,7 +568,7 @@ fn parse_const_expr(e: &Expr) -> Result { syn::visit::visit_expr(&mut expr_visitor, e); expr_visitor .0 - .map_or(Err(ParseError::RustConstTypeInvalid), |v| v) + .unwrap_or(Err(ParseError::RustConstTypeInvalid)) } // Helpers