summaryrefslogtreecommitdiff
path: root/cli/emit.rs
diff options
context:
space:
mode:
authorDavid Sherret <dsherret@users.noreply.github.com>2022-07-30 11:43:03 -0400
committerGitHub <noreply@github.com>2022-07-30 11:43:03 -0400
commitef5653be9823065e14189e412b52296bc4aeecb9 (patch)
tree2d5dd88b4d71fbe45cdd7587430c657050f52977 /cli/emit.rs
parent20a89d46c4af091f30daf0df20b12c91962f9b14 (diff)
refactor: reuse `FastInsecureHasher` in `get_check_hash` (#15354)
Diffstat (limited to 'cli/emit.rs')
-rw-r--r--cli/emit.rs10
1 files changed, 3 insertions, 7 deletions
diff --git a/cli/emit.rs b/cli/emit.rs
index 0ba7ccf08..4c347a09c 100644
--- a/cli/emit.rs
+++ b/cli/emit.rs
@@ -382,11 +382,7 @@ fn get_check_hash(
graph_data: &GraphData,
options: &CheckOptions,
) -> CheckHashResult {
- // twox hash is insecure, but fast so it works for our purposes
- use std::hash::Hasher;
- use twox_hash::XxHash64;
-
- let mut hasher = XxHash64::default();
+ let mut hasher = FastInsecureHasher::new();
hasher.write_u8(match options.type_check_mode {
TypeCheckMode::All => 0,
TypeCheckMode::Local => 1,
@@ -437,8 +433,8 @@ fn get_check_hash(
| MediaType::Wasm
| MediaType::Unknown => continue,
}
- hasher.write(specifier.as_str().as_bytes());
- hasher.write(code.as_bytes());
+ hasher.write_str(specifier.as_str());
+ hasher.write_str(code);
}
}