Skip to content

Commit

Permalink
Improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
edif2008 committed Jan 20, 2025
1 parent d6bbec8 commit 0a8efb0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion core/src/language/go.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions core/src/parser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,8 @@ pub(crate) fn parse_const(c: &ItemConst) -> Result<RustItem, ParseError> {
| RustType::Special(SpecialRustType::Option(_)) => {
return Err(ParseError::RustConstTypeInvalid);
}
RustType::Special(_s) => (),
RustType::Special(_) => (),
RustType::Simple { .. } => (),
_ => return Err(ParseError::RustConstTypeInvalid),
};

Expand Down Expand Up @@ -567,7 +568,7 @@ fn parse_const_expr(e: &Expr) -> Result<RustConstExpr, ParseError> {
syn::visit::visit_expr(&mut expr_visitor, e);
expr_visitor
.0
.map_or(Err(ParseError::RustConstTypeInvalid), |v| v)
.unwrap_or(Err(ParseError::RustConstTypeInvalid))
}

// Helpers
Expand Down

0 comments on commit 0a8efb0

Please sign in to comment.