From 3f176ca068fc080a7c6b2039e8d79fc545cfb7e0 Mon Sep 17 00:00:00 2001 From: juliancoffee Date: Tue, 15 Jun 2021 19:02:30 +0300 Subject: [PATCH] Panic if can't parse file --- voxygen/i18n/src/analysis.rs | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/voxygen/i18n/src/analysis.rs b/voxygen/i18n/src/analysis.rs index 13344b9c30..50887955fd 100644 --- a/voxygen/i18n/src/analysis.rs +++ b/voxygen/i18n/src/analysis.rs @@ -231,17 +231,14 @@ fn complete_key_versions<'a>( let full_path = i18n_file.path(); let path = full_path.strip_prefix(root_dir).unwrap(); let i18n_blob = read_file_from_path(&repo, &head_ref, &path); - let i18n: LocalizationFragment = match from_bytes(i18n_blob.content()) { - Ok(v) => v, - Err(e) => { - eprintln!( + let i18n: LocalizationFragment = + from_bytes(i18n_blob.content()).unwrap_or_else(|e| { + panic!( "Could not parse {} RON file, skipping: {}", i18n_file.path().to_string_lossy(), e - ); - continue; - }, - }; + ) + }); i18n_key_versions.extend(generate_key_version(&repo, &i18n, &path, &i18n_blob)); } } @@ -304,17 +301,13 @@ fn test_localization_directory( // Find the localization entry state let current_blob = read_file_from_path(&repo, &head_ref, &relfile); - let current_loc: RawLocalization = match from_bytes(current_blob.content()) { - Ok(v) => v, - Err(e) => { - eprintln!( - "Could not parse {} RON file, skipping: {}", - relfile.to_string_lossy(), - e - ); - return None; - }, - }; + let current_loc: RawLocalization = from_bytes(current_blob.content()).unwrap_or_else(|e| { + panic!( + "Could not parse {} RON file, skipping: {}", + relfile.to_string_lossy(), + e + ) + }); // Gather state of current localization let mut current_i18n = gather_state(