Since value and path are always the same for radio links, I removed the extra value.

This commit is contained in:
Tom Alexander 2023-10-07 01:46:22 -04:00
parent 592e773920
commit 6973d5a2c0
Signed by: talexander
GPG Key ID: D3A179C9A53C0EDE
3 changed files with 9 additions and 7 deletions

View File

@ -2860,7 +2860,7 @@ fn compare_radio_link<'b, 's>(
), ),
( (
EmacsField::Required(":raw-link"), EmacsField::Required(":raw-link"),
|r| Some(&r.raw_link), |r| Some(r.get_raw_link()),
compare_property_quoted_string compare_property_quoted_string
), ),
( (

View File

@ -41,7 +41,6 @@ pub(crate) fn radio_link<'b, 'g, 'r, 's>(
source: source.into(), source: source.into(),
children: rematched_target, children: rematched_target,
path: path.into(), path: path.into(),
raw_link: path.into(),
}, },
)); ));
} }
@ -194,8 +193,7 @@ mod tests {
&Object::RadioLink(RadioLink { &Object::RadioLink(RadioLink {
source: "bar ", source: "bar ",
children: vec![Object::PlainText(PlainText { source: "bar" })], children: vec![Object::PlainText(PlainText { source: "bar" })],
path: "bar".into(), path: "bar".into()
raw_link: "bar".into()
}) })
); );
} }
@ -238,8 +236,7 @@ mod tests {
source: "*bar* ", source: "*bar* ",
children: vec![Object::PlainText(PlainText { source: "bar" })] children: vec![Object::PlainText(PlainText { source: "bar" })]
})], })],
path: "*bar* ".into(), path: "*bar* ".into()
raw_link: "*bar* ".into()
}) })
); );
} }

View File

@ -98,7 +98,6 @@ pub struct RadioTarget<'s> {
pub struct RadioLink<'s> { pub struct RadioLink<'s> {
pub source: &'s str, pub source: &'s str,
pub path: &'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<Object<'s>>, pub children: Vec<Object<'s>>,
} }
@ -720,3 +719,9 @@ impl<'s> RegularLink<'s> {
}) })
} }
} }
impl<'s> RadioLink<'s> {
pub fn get_raw_link(&self) -> &'s str {
self.path
}
}