diff options
| author | Martin Haug <mhaug@live.de> | 2021-05-31 17:19:46 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2021-05-31 22:33:40 +0200 |
| commit | 37e08460377498165f421a522cb4eb1bb4e246b7 (patch) | |
| tree | 0480965d5497721db1f97d83057902fc2e2e719e /src/loading/fs.rs | |
| parent | 00ac68b8451179468aa39cba0d7fbea1ee20e0a1 (diff) | |
Test cases for include and import
Diffstat (limited to 'src/loading/fs.rs')
| -rw-r--r-- | src/loading/fs.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/loading/fs.rs b/src/loading/fs.rs index e2654a2e..a37d9630 100644 --- a/src/loading/fs.rs +++ b/src/loading/fs.rs @@ -194,9 +194,9 @@ fn load(cache: &mut FileCache, path: &Path) -> Option<Buffer> { /// Create a hash that is the same for all paths pointing to the same file. fn hash(path: &Path) -> Option<FileHash> { - Handle::from_path(path) - .map(|handle| FileHash(fxhash::hash64(&handle))) - .ok() + let file = File::open(path).ok()?; + let handle = Handle::from_file(file).ok()?; + Some(FileHash(fxhash::hash64(&handle))) } #[cfg(test)] |
