From 78a9b93f228a2bcdbb7527776e39f72b4bb52e4b Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Wed, 11 Oct 2023 14:03:42 -0400 Subject: [PATCH] Nevermind, it did work. --- src/compare/compare_field.rs | 13 ++++--------- src/compare/diff.rs | 11 +++++++++++ 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/compare/compare_field.rs b/src/compare/compare_field.rs index da8c644..3c07aba 100644 --- a/src/compare/compare_field.rs +++ b/src/compare/compare_field.rs @@ -1,12 +1,11 @@ -use std::borrow::Cow; use std::collections::BTreeSet; use std::fmt::Debug; use std::str::FromStr; use super::diff::artificial_diff_scope; +use super::diff::artificial_owned_diff_scope; use super::diff::compare_ast_node; use super::diff::DiffEntry; -use super::diff::DiffLayer; use super::diff::DiffStatus; use super::sexp::unquote; use super::sexp::Token; @@ -422,7 +421,7 @@ where pub(crate) fn compare_property_list_of_list_of_list_of_ast_nodes< 'b, 's, - 'x: 'b + 's, + 'x, R, RG: Fn(R) -> Option<&'b Vec>>>, >( @@ -481,12 +480,8 @@ pub(crate) fn compare_property_list_of_list_of_list_of_ast_nodes< for (e, r) in value.iter().zip(rust_value) { child_status.push(compare_ast_node(source, e, r.into())?); } - let diff_scope = DiffLayer { - name: Cow::Owned(emacs_field.to_string()), - children: child_status, - }; - // let diff_scope = artificial_diff_scope(emacs_field, child_status)?; - return Ok(ComparePropertiesResult::DiffEntry(diff_scope.into())); + let diff_scope = artificial_owned_diff_scope(emacs_field, child_status)?; + return Ok(ComparePropertiesResult::DiffEntry(diff_scope)); } Ok(ComparePropertiesResult::NoChange) } diff --git a/src/compare/diff.rs b/src/compare/diff.rs index 787f038..16f596e 100644 --- a/src/compare/diff.rs +++ b/src/compare/diff.rs @@ -331,6 +331,17 @@ pub(crate) fn artificial_diff_scope<'b, 's>( .into()) } +pub(crate) fn artificial_owned_diff_scope<'b, 's, 'x>( + name: &'x str, + children: Vec>, +) -> Result, Box> { + Ok(DiffLayer { + name: name.to_string().into(), + children, + } + .into()) +} + pub(crate) fn compare_ast_node<'b, 's>( source: &'s str, emacs: &'b Token<'s>,