aboutsummaryrefslogtreecommitdiffstats
path: root/askama_shared/src
diff options
context:
space:
mode:
Diffstat (limited to 'askama_shared/src')
-rw-r--r--askama_shared/src/escaping.rs9
1 files changed, 6 insertions, 3 deletions
diff --git a/askama_shared/src/escaping.rs b/askama_shared/src/escaping.rs
index a8a3559..99babfd 100644
--- a/askama_shared/src/escaping.rs
+++ b/askama_shared/src/escaping.rs
@@ -41,14 +41,17 @@ impl<T> Display for MarkupDisplay<T> where T: Display {
}
-fn escapable(b: &u8) -> bool {
- *b == b'<' || *b == b'>' || *b == b'&' || *b == b'"' || *b == b'\'' || *b == b'/'
+fn escapable(b: u8) -> bool {
+ match b {
+ b'<' | b'>' | b'&' | b'"' | b'\'' | b'/' => true,
+ _ => false,
+ }
}
pub fn escape(s: String) -> String {
let mut found = Vec::new();
for (i, b) in s.as_bytes().iter().enumerate() {
- if escapable(b) {
+ if escapable(*b) {
found.push(i);
}
}