Skip to content

Commit

Permalink
Fix lints & tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
Icelk committed Nov 19, 2023
1 parent 9a47609 commit d871029
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 4 additions & 4 deletions extensions/src/templates.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ pub async fn handle_template(
let mut start_byte = Some(0);

for (position, byte) in file.iter().copied().enumerate() {
let is_escape = byte == ESCAPE;
let is_escape = byte == b'\\';

match stage {
Stage::Text => {
Expand Down Expand Up @@ -136,7 +136,7 @@ pub async fn handle_template(
}
Stage::Placeholder if escaped != 1 => {
// If placeholder closed
if byte == R_SQ_BRACKET {
if byte == b'[' {
// Check if name is longer than empty
if position.checked_sub(placeholder_start + 3).is_some() {
// Good; we have UTF-8
Expand Down Expand Up @@ -190,7 +190,7 @@ fn extract_templates(file: Bytes) -> TemplateMap {
if byte == CR {
newline_size = 2;
}
let is_escape = byte == ESCAPE;
let is_escape = byte == b'\\';

match stage {
Stage::Text => {
Expand Down Expand Up @@ -223,7 +223,7 @@ fn extract_templates(file: Bytes) -> TemplateMap {
}
Stage::Placeholder if escaped != 1 => {
// If placeholder closed
if byte == R_SQ_BRACKET {
if byte == b']' {
// Check if name is longer than empty
if position.checked_sub(placeholder_start + 3).is_some() {
// Good; we have UTF-8
Expand Down
4 changes: 0 additions & 4 deletions src/extensions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,6 @@ pub trait PresentCall: KvarnSendSync {
/// # Arguments
///
/// [`PresentData`] contains all the references to the data needed.
///
/// > The use of a separate struct for all the references is a product of the previous design,
/// > before the macros and [`utils::SuperUnsafePointer`]s. Then, you had to do the `unsafe` dereferencing
/// > yourself. Only having to dereference one struct was easier.
fn call<'a>(&'a self, present_data: &'a mut PresentData<'a>) -> RetFut<'a, ()>;
}
impl<F: for<'a> Fn(&'a mut PresentData<'a>) -> RetFut<'a, ()> + KvarnSendSync> PresentCall for F {
Expand Down

0 comments on commit d871029

Please sign in to comment.