mirror of
https://github.com/askama-rs/askama.git
synced 2025-09-29 22:11:17 +00:00
Remove a #[allow(clippy::match_wild_err_arm)]
This commit is contained in:
parent
83ef00c191
commit
7bc362fcdc
@ -298,38 +298,32 @@ 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 {
|
||||
Err(CompileError::new(
|
||||
format!(
|
||||
"unable to open template file '{}'",
|
||||
tpl_path.to_str().unwrap(),
|
||||
),
|
||||
Some(FileInfo::new(
|
||||
node_file,
|
||||
Some(file_source),
|
||||
Some(node_source),
|
||||
)),
|
||||
))
|
||||
} else {
|
||||
Err(CompileError::no_file_info(format!(
|
||||
"unable to open template file '{}'",
|
||||
tpl_path.to_str().unwrap()
|
||||
)))
|
||||
}
|
||||
}
|
||||
Ok(mut source) => {
|
||||
if source.ends_with('\n') {
|
||||
let _ = source.pop();
|
||||
}
|
||||
Ok(source)
|
||||
) -> 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 '{}'",
|
||||
tpl_path.to_str().unwrap(),
|
||||
),
|
||||
Some(FileInfo::new(
|
||||
node_file,
|
||||
Some(file_source),
|
||||
Some(node_source),
|
||||
)),
|
||||
))
|
||||
} else {
|
||||
Err(CompileError::no_file_info(format!(
|
||||
"unable to open template file '{}'",
|
||||
tpl_path.to_str().unwrap(),
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user