mirror of
https://github.com/askama-rs/askama.git
synced 2025-09-30 06:21:13 +00:00
Remove intermediate allocations for error messages
This commit is contained in:
parent
cae09c50f4
commit
d0dcc1c0ce
@ -148,7 +148,7 @@ impl Config {
|
||||
|
||||
if !syntaxes.contains_key(default_syntax) {
|
||||
return Err(CompileError::new(
|
||||
format!("default syntax \"{default_syntax}\" not found"),
|
||||
format_args!("default syntax \"{default_syntax}\" not found"),
|
||||
file_info,
|
||||
));
|
||||
}
|
||||
@ -342,13 +342,13 @@ pub(crate) fn read_config_file(
|
||||
if filename.exists() {
|
||||
fs::read_to_string(&filename).map_err(|err| {
|
||||
CompileError::no_file_info(
|
||||
format!("unable to read {}: {err}", filename.display()),
|
||||
format_args!("unable to read {}: {err}", filename.display()),
|
||||
span,
|
||||
)
|
||||
})
|
||||
} else if config_path.is_some() {
|
||||
Err(CompileError::no_file_info(
|
||||
format!("`{}` does not exist", filename.display()),
|
||||
format_args!("`{}` does not exist", filename.display()),
|
||||
span,
|
||||
))
|
||||
} else {
|
||||
|
@ -754,8 +754,9 @@ impl State<'_, '_> {
|
||||
.parse_next(i)?;
|
||||
if let Some(control) = control {
|
||||
let message = format!(
|
||||
"unclosed block, you likely meant to apply whitespace control: {:?}",
|
||||
format!("{control}{}", self.syntax.block_end),
|
||||
"unclosed block, you likely meant to apply whitespace control: \"{}{}\"",
|
||||
control.escape_default(),
|
||||
self.syntax.block_end.escape_default(),
|
||||
);
|
||||
Err(ParseErr::backtrack(ErrorContext::new(message, *i).into()))
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user