Skip to content
This repository was archived by the owner on Mar 11, 2025. It is now read-only.

Commit c9613ff

Browse files
Kijewskidjc
authored andcommitted
Fix typos
1 parent 70c5784 commit c9613ff

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

askama_derive/src/generator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ fn find_used_templates(
205205
let dependency_path = (path.clone(), extends.clone());
206206
if dependency_graph.contains(&dependency_path) {
207207
return Err(format!(
208-
"cyclic dependecy in graph {:#?}",
208+
"cyclic dependency in graph {:#?}",
209209
dependency_graph
210210
.iter()
211211
.map(|e| format!("{:#?} --> {:#?}", e.0, e.1))
@@ -1211,7 +1211,7 @@ impl<'a> Generator<'a> {
12111211
};
12121212

12131213
let id = match expr_cache.entry(expression.clone()) {
1214-
Entry::Occupied(e) if s.is_cachable() => *e.get(),
1214+
Entry::Occupied(e) if s.is_cacheable() => *e.get(),
12151215
e => {
12161216
let id = self.named;
12171217
self.named += 1;

askama_derive/src/parser/expr.rs

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ impl Expr<'_> {
8484
/// Returns `true` if the outcome of this expression may be used multiple times in the same
8585
/// `write!()` call, without evaluating the expression again, i.e. the expression should be
8686
/// side-effect free.
87-
pub(crate) fn is_cachable(&self) -> bool {
87+
pub(crate) fn is_cacheable(&self) -> bool {
8888
match self {
8989
// Literals are the definition of pure:
9090
Expr::BoolLit(_) => true,
@@ -95,18 +95,18 @@ impl Expr<'_> {
9595
Expr::Var(_) => true,
9696
Expr::Path(_) => true,
9797
// Check recursively:
98-
Expr::Array(args) => args.iter().all(|arg| arg.is_cachable()),
99-
Expr::Attr(lhs, _) => lhs.is_cachable(),
100-
Expr::Index(lhs, rhs) => lhs.is_cachable() && rhs.is_cachable(),
101-
Expr::Filter(_, args) => args.iter().all(|arg| arg.is_cachable()),
102-
Expr::Unary(_, arg) => arg.is_cachable(),
103-
Expr::BinOp(_, lhs, rhs) => lhs.is_cachable() && rhs.is_cachable(),
98+
Expr::Array(args) => args.iter().all(|arg| arg.is_cacheable()),
99+
Expr::Attr(lhs, _) => lhs.is_cacheable(),
100+
Expr::Index(lhs, rhs) => lhs.is_cacheable() && rhs.is_cacheable(),
101+
Expr::Filter(_, args) => args.iter().all(|arg| arg.is_cacheable()),
102+
Expr::Unary(_, arg) => arg.is_cacheable(),
103+
Expr::BinOp(_, lhs, rhs) => lhs.is_cacheable() && rhs.is_cacheable(),
104104
Expr::Range(_, lhs, rhs) => {
105-
lhs.as_ref().map_or(true, |v| v.is_cachable())
106-
&& rhs.as_ref().map_or(true, |v| v.is_cachable())
105+
lhs.as_ref().map_or(true, |v| v.is_cacheable())
106+
&& rhs.as_ref().map_or(true, |v| v.is_cacheable())
107107
}
108-
Expr::Group(arg) => arg.is_cachable(),
109-
Expr::Tuple(args) => args.iter().all(|arg| arg.is_cachable()),
108+
Expr::Group(arg) => arg.is_cacheable(),
109+
Expr::Tuple(args) => args.iter().all(|arg| arg.is_cacheable()),
110110
// We have too little information to tell if the expression is pure:
111111
Expr::Call(_, _) => false,
112112
Expr::RustMacro(_, _) => false,

0 commit comments

Comments
 (0)