aboutsummaryrefslogtreecommitdiffstats
path: root/askama_derive/src/parser/expr.rs
diff options
context:
space:
mode:
authorLibravatar René Kijewski <rene.kijewski@fu-berlin.de>2023-02-24 18:23:25 +0100
committerLibravatar Dirkjan Ochtman <dirkjan@ochtman.nl>2023-02-24 18:58:35 +0100
commitc9613ff6029ee58dc3f94c3dd955b905ed7fc9ef (patch)
tree8cc2448c5eb2a5eab54c006b24f205253e34e12b /askama_derive/src/parser/expr.rs
parent70c5784a9ebc1e2f9e97d5358c7b686111ea18f4 (diff)
downloadaskama-c9613ff6029ee58dc3f94c3dd955b905ed7fc9ef.tar.gz
askama-c9613ff6029ee58dc3f94c3dd955b905ed7fc9ef.tar.bz2
askama-c9613ff6029ee58dc3f94c3dd955b905ed7fc9ef.zip
Fix typos
Diffstat (limited to '')
-rw-r--r--askama_derive/src/parser/expr.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/askama_derive/src/parser/expr.rs b/askama_derive/src/parser/expr.rs
index 4546e04..fabaa34 100644
--- a/askama_derive/src/parser/expr.rs
+++ b/askama_derive/src/parser/expr.rs
@@ -84,7 +84,7 @@ impl Expr<'_> {
/// Returns `true` if the outcome of this expression may be used multiple times in the same
/// `write!()` call, without evaluating the expression again, i.e. the expression should be
/// side-effect free.
- pub(crate) fn is_cachable(&self) -> bool {
+ pub(crate) fn is_cacheable(&self) -> bool {
match self {
// Literals are the definition of pure:
Expr::BoolLit(_) => true,
@@ -95,18 +95,18 @@ impl Expr<'_> {
Expr::Var(_) => true,
Expr::Path(_) => true,
// Check recursively:
- Expr::Array(args) => args.iter().all(|arg| arg.is_cachable()),
- Expr::Attr(lhs, _) => lhs.is_cachable(),
- Expr::Index(lhs, rhs) => lhs.is_cachable() && rhs.is_cachable(),
- Expr::Filter(_, args) => args.iter().all(|arg| arg.is_cachable()),
- Expr::Unary(_, arg) => arg.is_cachable(),
- Expr::BinOp(_, lhs, rhs) => lhs.is_cachable() && rhs.is_cachable(),
+ Expr::Array(args) => args.iter().all(|arg| arg.is_cacheable()),
+ Expr::Attr(lhs, _) => lhs.is_cacheable(),
+ Expr::Index(lhs, rhs) => lhs.is_cacheable() && rhs.is_cacheable(),
+ Expr::Filter(_, args) => args.iter().all(|arg| arg.is_cacheable()),
+ Expr::Unary(_, arg) => arg.is_cacheable(),
+ Expr::BinOp(_, lhs, rhs) => lhs.is_cacheable() && rhs.is_cacheable(),
Expr::Range(_, lhs, rhs) => {
- lhs.as_ref().map_or(true, |v| v.is_cachable())
- && rhs.as_ref().map_or(true, |v| v.is_cachable())
+ lhs.as_ref().map_or(true, |v| v.is_cacheable())
+ && rhs.as_ref().map_or(true, |v| v.is_cacheable())
}
- Expr::Group(arg) => arg.is_cachable(),
- Expr::Tuple(args) => args.iter().all(|arg| arg.is_cachable()),
+ Expr::Group(arg) => arg.is_cacheable(),
+ Expr::Tuple(args) => args.iter().all(|arg| arg.is_cacheable()),
// We have too little information to tell if the expression is pure:
Expr::Call(_, _) => false,
Expr::RustMacro(_, _) => false,