compare_properties comment.
This commit is contained in:
parent
4c89d6c813
commit
926682d513
@ -1484,24 +1484,34 @@ fn compare_footnote_definition<'b, 's>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
fn compare_comment<'b, 's>(
|
fn compare_comment<'b, 's>(
|
||||||
_source: &'s str,
|
source: &'s str,
|
||||||
emacs: &'b Token<'s>,
|
emacs: &'b Token<'s>,
|
||||||
rust: &'b Comment<'s>,
|
rust: &'b Comment<'s>,
|
||||||
) -> Result<DiffEntry<'b, 's>, Box<dyn std::error::Error>> {
|
) -> Result<DiffEntry<'b, 's>, Box<dyn std::error::Error>> {
|
||||||
let child_status = Vec::new();
|
|
||||||
let mut this_status = DiffStatus::Good;
|
let mut this_status = DiffStatus::Good;
|
||||||
|
let mut child_status = Vec::new();
|
||||||
let mut message = None;
|
let mut message = None;
|
||||||
|
|
||||||
// Compare value
|
assert_no_children(emacs, &mut this_status, &mut message)?;
|
||||||
let value =
|
|
||||||
get_property_quoted_string(emacs, ":value")?.ok_or("Comments should have a value.")?;
|
for diff in compare_properties!(
|
||||||
let rust_value = rust.get_value();
|
source,
|
||||||
if value != rust_value {
|
emacs,
|
||||||
this_status = DiffStatus::Bad;
|
rust,
|
||||||
message = Some(format!(
|
(
|
||||||
"Value mismatch (emacs != rust) {:?} != {:?}",
|
EmacsField::Required(":value"),
|
||||||
value, rust_value
|
|r| Some(r.get_value()),
|
||||||
));
|
compare_property_quoted_string
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
match diff {
|
||||||
|
ComparePropertiesResult::NoChange => {}
|
||||||
|
ComparePropertiesResult::SelfChange(new_status, new_message) => {
|
||||||
|
this_status = new_status;
|
||||||
|
message = new_message
|
||||||
|
}
|
||||||
|
ComparePropertiesResult::DiffEntry(diff_entry) => child_status.push(diff_entry),
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(DiffResult {
|
Ok(DiffResult {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user