diff --git a/src/renderer/renderer.rs b/src/renderer/renderer.rs index d7c1df6..ec645f0 100644 --- a/src/renderer/renderer.rs +++ b/src/renderer/renderer.rs @@ -14,7 +14,7 @@ use crate::renderer::inline_partial_tree::extract_inline_partials; use crate::renderer::inline_partial_tree::InlinePartialTreeElement; use crate::renderer::parameters_context::ParametersContext; use crate::renderer::walking::walk_path; -use std::collections::HashMap; +use std::{cmp::Ordering, collections::HashMap}; #[derive(Clone, Debug)] pub struct CompiledTemplate<'a> { @@ -337,25 +337,25 @@ impl<'a> DustRenderer<'a> { match (left_side, right_side) { (Err(_), _) | (_, Err(_)) => { return self.render_maybe_body( - ¶meterized_block.contents, + ¶meterized_block.else_contents, breadcrumbs, blocks, ) } (Ok(left_side_unwrapped), Ok(right_side_unwrapped)) => { - if left_side_unwrapped >= right_side_unwrapped { - return self.render_maybe_body( - ¶meterized_block.contents, - breadcrumbs, - blocks, - ); - } else { - return self.render_maybe_body( + return match left_side_unwrapped.partial_cmp(&right_side_unwrapped) { + Some(Ordering::Greater) | Some(Ordering::Equal) | None => self + .render_maybe_body( + ¶meterized_block.contents, + breadcrumbs, + blocks, + ), + Some(Ordering::Less) => self.render_maybe_body( ¶meterized_block.else_contents, breadcrumbs, blocks, - ); - } + ), + }; } } }