From 6973d5a2c0dbba3486cfa458e53f8dbae6522c59 Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Sat, 7 Oct 2023 01:46:22 -0400 Subject: [PATCH] Since value and path are always the same for radio links, I removed the extra value. --- src/compare/diff.rs | 2 +- src/parser/radio_link.rs | 7 ++----- src/types/object.rs | 7 ++++++- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/src/compare/diff.rs b/src/compare/diff.rs index c08e559a..8fd64b3a 100644 --- a/src/compare/diff.rs +++ b/src/compare/diff.rs @@ -2860,7 +2860,7 @@ fn compare_radio_link<'b, 's>( ), ( EmacsField::Required(":raw-link"), - |r| Some(&r.raw_link), + |r| Some(r.get_raw_link()), compare_property_quoted_string ), ( diff --git a/src/parser/radio_link.rs b/src/parser/radio_link.rs index 5edd8b6f..59553445 100644 --- a/src/parser/radio_link.rs +++ b/src/parser/radio_link.rs @@ -41,7 +41,6 @@ pub(crate) fn radio_link<'b, 'g, 'r, 's>( source: source.into(), children: rematched_target, path: path.into(), - raw_link: path.into(), }, )); } @@ -194,8 +193,7 @@ mod tests { &Object::RadioLink(RadioLink { source: "bar ", children: vec![Object::PlainText(PlainText { source: "bar" })], - path: "bar".into(), - raw_link: "bar".into() + path: "bar".into() }) ); } @@ -238,8 +236,7 @@ mod tests { source: "*bar* ", children: vec![Object::PlainText(PlainText { source: "bar" })] })], - path: "*bar* ".into(), - raw_link: "*bar* ".into() + path: "*bar* ".into() }) ); } diff --git a/src/types/object.rs b/src/types/object.rs index ea884f04..107ee0e7 100644 --- a/src/types/object.rs +++ b/src/types/object.rs @@ -98,7 +98,6 @@ pub struct RadioTarget<'s> { pub struct RadioLink<'s> { pub source: &'s str, pub path: &'s str, - pub raw_link: &'s str, // TODO: Is this always the same as path? If so, this could be a function instead of a field. pub children: Vec>, } @@ -720,3 +719,9 @@ impl<'s> RegularLink<'s> { }) } } + +impl<'s> RadioLink<'s> { + pub fn get_raw_link(&self) -> &'s str { + self.path + } +}