diff options
author | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2021-06-14 11:21:10 +0200 |
---|---|---|
committer | Dirkjan Ochtman <dirkjan@ochtman.nl> | 2021-06-14 11:47:13 +0200 |
commit | 25eae265a2d14a33a1723bfa0c5dc7a7f6b5a6ab (patch) | |
tree | ad0268e6fc443b8d2396855ba5f128705e3a506f /askama_shared/src/generator.rs | |
parent | c0e75554d2e7b1f51c26f5af304a7fb64e9a69e8 (diff) | |
download | askama-25eae265a2d14a33a1723bfa0c5dc7a7f6b5a6ab.tar.gz askama-25eae265a2d14a33a1723bfa0c5dc7a7f6b5a6ab.tar.bz2 askama-25eae265a2d14a33a1723bfa0c5dc7a7f6b5a6ab.zip |
Fix needless borrowing
Diffstat (limited to 'askama_shared/src/generator.rs')
-rw-r--r-- | askama_shared/src/generator.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/askama_shared/src/generator.rs b/askama_shared/src/generator.rs index 20f2c08..4bd2a63 100644 --- a/askama_shared/src/generator.rs +++ b/askama_shared/src/generator.rs @@ -148,7 +148,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { let size_hint = if let Some(heritage) = self.heritage { self.handle(heritage.root, heritage.root.nodes, buf, AstLevel::Top) } else { - self.handle(ctx, &ctx.nodes, buf, AstLevel::Top) + self.handle(ctx, ctx.nodes, buf, AstLevel::Top) }?; self.flush_ws(Ws(false, false)); @@ -598,7 +598,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { buf.write(param.0); if let Some(param) = ¶m.1 { buf.write(":"); - self.visit_match_param(buf, ¶m); + self.visit_match_param(buf, param); } } buf.write("}"); @@ -1448,7 +1448,7 @@ impl<'a, S: std::hash::BuildHasher> Generator<'a, S> { return DisplayWrap::Unwrapped; } - buf.write(normalize_identifier(&self.locals.resolve_or_self(&s))); + buf.write(normalize_identifier(&self.locals.resolve_or_self(s))); DisplayWrap::Unwrapped } @@ -1648,7 +1648,7 @@ where } fn contains(&self, key: &K) -> bool { - self.scopes.iter().rev().any(|set| set.contains_key(&key)) + self.scopes.iter().rev().any(|set| set.contains_key(key)) || match self.parent { Some(set) => set.contains(key), None => false, @@ -1660,7 +1660,7 @@ where fn get(&self, key: &K) -> Option<&V> { let scopes = self.scopes.iter().rev(); scopes - .filter_map(|set| set.get(&key)) + .filter_map(|set| set.get(key)) .next() .or_else(|| self.parent.and_then(|set| set.get(key))) } |