Remove unused code and clean up warnings.
This commit is contained in:
@@ -2,10 +2,8 @@ use crate::parser::template;
|
||||
use crate::parser::Body;
|
||||
use crate::parser::DustTag;
|
||||
use crate::parser::Filter;
|
||||
use crate::parser::KVPair;
|
||||
use crate::parser::PartialNameElement;
|
||||
use crate::parser::Path;
|
||||
use crate::parser::RValue;
|
||||
use crate::parser::Special;
|
||||
use crate::parser::Template;
|
||||
use crate::parser::TemplateElement;
|
||||
@@ -21,10 +19,8 @@ use crate::renderer::inline_partial_tree::extract_inline_partials;
|
||||
use crate::renderer::inline_partial_tree::InlinePartialTreeElement;
|
||||
use crate::renderer::iteration_context::IterationContext;
|
||||
use crate::renderer::parameters_context::ParametersContext;
|
||||
use crate::renderer::tree_walking::walk_path;
|
||||
use std::borrow::Borrow;
|
||||
use crate::renderer::walking::walk_path;
|
||||
use std::collections::HashMap;
|
||||
use std::rc::Rc;
|
||||
|
||||
#[derive(Clone, Debug)]
|
||||
pub struct DustRenderer<'a> {
|
||||
@@ -32,7 +28,7 @@ pub struct DustRenderer<'a> {
|
||||
}
|
||||
|
||||
pub fn compile_template<'a>(source: &'a str) -> Result<Template<'a>, CompileError> {
|
||||
let (_remaining, parsed_template) = template(source).map_err(|err| CompileError {
|
||||
let (_remaining, parsed_template) = template(source).map_err(|_err| CompileError {
|
||||
message: "Failed to compile template".to_owned(),
|
||||
})?;
|
||||
Ok(parsed_template)
|
||||
@@ -391,7 +387,7 @@ impl<'a> DustRenderer<'a> {
|
||||
// equal. This is particularly important for objects
|
||||
// which compare memory locations rather than contents
|
||||
// (javascript object equality).
|
||||
if Self::new_are_paths_identical(&left_side, &right_side)
|
||||
if Self::are_paths_identical(&left_side, &right_side)
|
||||
|| left_side.as_ref().map(|maybe_ice| {
|
||||
maybe_ice
|
||||
.as_ref()
|
||||
@@ -440,7 +436,7 @@ impl<'a> DustRenderer<'a> {
|
||||
// equal. This is particularly important for objects
|
||||
// which compare memory locations rather than contents
|
||||
// (javascript object equality).
|
||||
if Self::new_are_paths_identical(&left_side, &right_side)
|
||||
if Self::are_paths_identical(&left_side, &right_side)
|
||||
|| left_side.as_ref().map(|maybe_ice| {
|
||||
maybe_ice
|
||||
.as_ref()
|
||||
@@ -648,7 +644,6 @@ impl<'a> DustRenderer<'a> {
|
||||
}
|
||||
}
|
||||
}
|
||||
_ => panic!("Unsupported tag"),
|
||||
}
|
||||
|
||||
Ok("".to_owned())
|
||||
@@ -760,26 +755,6 @@ impl<'a> DustRenderer<'a> {
|
||||
}
|
||||
|
||||
fn are_paths_identical<'b>(
|
||||
param_map: &ParametersContext<'b>,
|
||||
left_key: &str,
|
||||
right_key: &str,
|
||||
) -> bool {
|
||||
match (
|
||||
param_map.get_original_rvalue(left_key),
|
||||
param_map.get_original_rvalue(right_key),
|
||||
) {
|
||||
(None, _) => false,
|
||||
(_, None) => false,
|
||||
(Some(key_rval), Some(value_rval)) => match (key_rval, value_rval) {
|
||||
(RValue::RVPath(key_path), RValue::RVPath(value_path)) => {
|
||||
key_path.keys == value_path.keys
|
||||
}
|
||||
_ => false,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
fn new_are_paths_identical<'b>(
|
||||
left_side: &Result<Option<IceResult<'b>>, WalkError>,
|
||||
right_side: &Result<Option<IceResult<'b>>, WalkError>,
|
||||
) -> bool {
|
||||
|
||||
Reference in New Issue
Block a user