Sfoglia il codice sorgente

zkas: formatting, typos, clippy

y 2 anni fa
parent
commit
3b52ed4e27
2 ha cambiato i file con 12 aggiunte e 14 eliminazioni
  1. 10 12
      src/zkas/analyzer.rs
  2. 2 2
      src/zkas/parser.rs

+ 10 - 12
src/zkas/analyzer.rs

@@ -270,18 +270,16 @@ impl Analyzer {
                                 v.column,
                             ))
                         }
-                    } else if arg_types[0] == VarType::ScalarArray {
-                        if var_type != VarType::Scalar {
-                            return Err(self.error.abort(
-                                &format!(
-                                    "Incorrect argument type. Expected `{:?}`, got `{:?}`.",
-                                    VarType::Scalar,
-                                    var_type
-                                ),
-                                v.line,
-                                v.column,
-                            ))
-                        }
+                    } else if arg_types[0] == VarType::ScalarArray && var_type != VarType::Scalar {
+                        return Err(self.error.abort(
+                            &format!(
+                                "Incorrect argument type. Expected `{:?}`, got `{:?}`.",
+                                VarType::Scalar,
+                                var_type
+                            ),
+                            v.line,
+                            v.column,
+                        ))
                     }
                     // Validation for non-Array types
                     if var_type != arg_types[idx] {

+ 2 - 2
src/zkas/parser.rs

@@ -124,7 +124,7 @@ impl Parser {
         let mut ast_inner = IndexMap::new();
         let mut ast = IndexMap::new();
 
-        if self.tokens.len() == 0 {
+        if self.tokens.is_empty() {
             return Err(self.error.abort("Source file does not contain any valid tokens.", 0, 0))
         }
 
@@ -1056,7 +1056,7 @@ impl Parser {
                     // x => unimplemented!("{:#?}", x),
                     _ => {
                         return Err(self.error.abort(
-                            &format!("Characer is illegal/unimplemented in this context",),
+                            "Character is illegal/unimplemented in this context",
                             arg.line,
                             arg.column,
                         ))