Make if statement more idiomatic

master
LeRoyce Pearson 2020-04-30 17:12:29 -06:00 committed by Andrew Kelley
parent 2c59f95e87
commit 42007307be
1 changed files with 4 additions and 2 deletions

View File

@ -182,9 +182,11 @@ pub const CacheHash = struct {
if (file_path.len == 0) {
return error.InvalidFormat;
}
if (cache_hash_file.path != null and !mem.eql(u8, file_path, cache_hash_file.path.?)) {
if (cache_hash_file.path) |p| {
if (!mem.eql(u8, file_path, p)) {
return error.InvalidFormat;
}
}
if (cache_hash_file.path == null) {
cache_hash_file.path = try mem.dupe(self.alloc, u8, file_path);