Simplify hash calculation.

This commit is contained in:
Stephen Chung 2020-10-28 22:30:29 +08:00
parent f5ffbfbe06
commit bed6364dcb

View File

@ -122,19 +122,11 @@ fn calc_fn_hash<'a>(
// We always skip the first module
modules.skip(1).for_each(|m| m.hash(s));
s.write(fn_name.as_bytes());
let num = if let Some(num) = num {
num
} else {
let mut count = 0;
params.for_each(|t| {
count += 1;
t.hash(s);
});
count
};
if let Some(num) = num {
s.write_usize(num);
} else {
params.for_each(|t| t.hash(s));
}
s.finish()
}