Skip to content

Commit

Permalink
Readability improvement for #each.
Browse files Browse the repository at this point in the history
  • Loading branch information
mkantor committed Sep 8, 2020
1 parent 57af8f4 commit 5930fdd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/helpers/helper_each.rs
Expand Up @@ -5,7 +5,7 @@ use crate::block::{BlockContext, BlockParams};
use crate::context::Context;
use crate::error::RenderError;
use crate::helpers::{HelperDef, HelperResult};
use crate::json::value::{to_json, JsonTruthy};
use crate::json::value::to_json;
use crate::output::Output;
use crate::registry::Registry;
use crate::render::{Helper, RenderContext, Renderable};
Expand Down Expand Up @@ -79,8 +79,8 @@ impl HelperDef for EachHelper {
let template = h.template();

match template {
Some(t) => match (value.value().is_truthy(false), value.value()) {
(true, &Json::Array(ref list)) => {
Some(t) => match *value.value() {
Json::Array(ref list) if !list.is_empty() => {
let block_context = create_block(&value)?;
rc.push_block(block_context);

Expand Down Expand Up @@ -108,7 +108,7 @@ impl HelperDef for EachHelper {
rc.pop_block();
Ok(())
}
(true, &Json::Object(ref obj)) => {
Json::Object(ref obj) if !obj.is_empty() => {
let block_context = create_block(&value)?;
rc.push_block(block_context);

Expand Down

0 comments on commit 5930fdd

Please sign in to comment.