Remove HashSet::from(...)

This commit is contained in:
Guojie Luo 2022-02-27 11:20:21 +08:00
parent 47d2307d1f
commit deb3ee2b23
2 changed files with 3 additions and 3 deletions

View File

@ -1,6 +1,5 @@
use crate::cst::{Expression, ModuleContext, Tag, Tools};
use json::JsonValue;
use std::collections::HashSet;
#[allow(unused_imports)]
use log::{debug, error, info, trace, warn};
@ -15,7 +14,8 @@ impl EventExpressionList {
);
for json_expression in json_expressions {
let json_children = &json_expression["children"];
assert!(HashSet::from([1, 2]).contains(&json_children.len()));
assert!(json_children.len() == 1 || json_children.len() == 2);
match json_children[0]["tag"].as_str() {
Some(Tag::POS_EDGE) => Expression::codegen(&json_children[1], context),
Some(Tag::NEG_EDGE) => Expression::codegen(&json_children[1], context),

View File

@ -374,7 +374,7 @@ impl ModuleDeclaration {
fn get_var_width(json: &JsonValue, dim_path: Vec<&str>) -> usize {
let json_dims = Tools::match_tags(vec![json], dim_path);
assert!(HashSet::from([0, 2]).contains(&json_dims.len()));
assert!(json_dims.len() == 0 || json_dims.len() == 2);
match json_dims.len() {
2 => {