Remove a #[allow(clippy::match_wild_err_arm)]

This commit is contained in:
René Kijewski 2024-07-04 09:51:50 +02:00
parent 83ef00c191
commit 7bc362fcdc

View File

@ -298,14 +298,16 @@ where
vals.iter().map(|s| s.to_string()).collect()
}
#[allow(clippy::match_wild_err_arm)]
pub(crate) fn get_template_source(
tpl_path: &Path,
import_from: Option<(&Rc<Path>, &str, &str)>,
) -> std::result::Result<String, CompileError> {
match fs::read_to_string(tpl_path) {
Err(_) => {
if let Some((node_file, file_source, node_source)) = import_from {
) -> Result<String, CompileError> {
if let Ok(mut source) = fs::read_to_string(tpl_path) {
if source.ends_with('\n') {
let _ = source.pop();
}
Ok(source)
} else if let Some((node_file, file_source, node_source)) = import_from {
Err(CompileError::new(
format!(
"unable to open template file '{}'",
@ -320,17 +322,9 @@ pub(crate) fn get_template_source(
} else {
Err(CompileError::no_file_info(format!(
"unable to open template file '{}'",
tpl_path.to_str().unwrap()
tpl_path.to_str().unwrap(),
)))
}
}
Ok(mut source) => {
if source.ends_with('\n') {
let _ = source.pop();
}
Ok(source)
}
}
}
static CONFIG_FILE_NAME: &str = "rinja.toml";