Skip to content

Commit

Permalink
Remove unused template function limit_line_length()
Browse files Browse the repository at this point in the history
  • Loading branch information
kellpossible committed Apr 14, 2024
1 parent 0e94964 commit 92f555f
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions src/templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -428,31 +428,6 @@ pub async fn middleware(
},
)
});
environment.add_function("limit_line_length", |string: &str, length: usize| {
let mut new_string = String::with_capacity(string.len());
for line in string.lines() {
let mut line = line;
if line.chars().count() <= length {
new_string.push_str(line);
new_string.push('\n');
continue;
}
while line.chars().count() > length {
let split_position = line
.char_indices()
.enumerate()
.find_map(|(i, (p, _c))| if i >= length { Some(p) } else { None })
.expect("Expected to find split position");
let (before, after) = line.split_at(split_position);
new_string.push_str(before);
new_string.push('\n');
line = after;
}
new_string.push_str(line);
new_string.push('\n');
}
new_string
});
let uri = request.uri();
let query_value: Value = uri
.query()
Expand Down

0 comments on commit 92f555f

Please sign in to comment.