Apply more suggestions.
This commit is contained in:
parent
2dd5246506
commit
b4f9a3b9b6
@ -157,10 +157,13 @@ mod tests {
|
|||||||
let global_settings = GlobalSettings::default();
|
let global_settings = GlobalSettings::default();
|
||||||
let initial_context = ContextElement::document_context();
|
let initial_context = ContextElement::document_context();
|
||||||
let initial_context = Context::new(&global_settings, List::new(&initial_context));
|
let initial_context = Context::new(&global_settings, List::new(&initial_context));
|
||||||
let plain_text_matcher = parser_with_context!(plain_text(
|
let (remaining, result) = map(
|
||||||
detect_standard_set_object_sans_plain_text
|
parser_with_context!(plain_text(detect_standard_set_object_sans_plain_text))(
|
||||||
))(&initial_context);
|
&initial_context,
|
||||||
let (remaining, result) = map(plain_text_matcher, Object::PlainText)(input).unwrap();
|
),
|
||||||
|
Object::PlainText,
|
||||||
|
)(input)
|
||||||
|
.unwrap();
|
||||||
assert_eq!(Into::<&str>::into(remaining), "");
|
assert_eq!(Into::<&str>::into(remaining), "");
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
result.get_standard_properties().get_source(),
|
result.get_standard_properties().get_source(),
|
||||||
|
@ -185,15 +185,14 @@ mod tests {
|
|||||||
fn plain_text_radio_target() {
|
fn plain_text_radio_target() {
|
||||||
let input = OrgSource::new("foo bar baz");
|
let input = OrgSource::new("foo bar baz");
|
||||||
let radio_target_match = vec![Object::PlainText(PlainText { source: "bar" })];
|
let radio_target_match = vec![Object::PlainText(PlainText { source: "bar" })];
|
||||||
let global_settings = {
|
let global_settings = GlobalSettings {
|
||||||
let mut global_settings = GlobalSettings::default();
|
radio_targets: vec![&radio_target_match],
|
||||||
global_settings.radio_targets = vec![&radio_target_match];
|
..Default::default()
|
||||||
global_settings
|
|
||||||
};
|
};
|
||||||
let initial_context = ContextElement::document_context();
|
let initial_context = ContextElement::document_context();
|
||||||
let initial_context = Context::new(&global_settings, List::new(&initial_context));
|
let initial_context = Context::new(&global_settings, List::new(&initial_context));
|
||||||
let paragraph_matcher = parser_with_context!(element(true))(&initial_context);
|
let (remaining, first_paragraph) =
|
||||||
let (remaining, first_paragraph) = paragraph_matcher(input).expect("Parse first paragraph");
|
element(true)(&initial_context, input).expect("Parse first paragraph");
|
||||||
let first_paragraph = match first_paragraph {
|
let first_paragraph = match first_paragraph {
|
||||||
Element::Paragraph(paragraph) => paragraph,
|
Element::Paragraph(paragraph) => paragraph,
|
||||||
_ => panic!("Should be a paragraph!"),
|
_ => panic!("Should be a paragraph!"),
|
||||||
@ -212,7 +211,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"
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -224,15 +223,15 @@ mod tests {
|
|||||||
source: "*bar*",
|
source: "*bar*",
|
||||||
children: vec![Object::PlainText(PlainText { source: "bar" })],
|
children: vec![Object::PlainText(PlainText { source: "bar" })],
|
||||||
})];
|
})];
|
||||||
let global_settings = {
|
let global_settings = GlobalSettings {
|
||||||
let mut global_settings = GlobalSettings::default();
|
radio_targets: vec![&radio_target_match],
|
||||||
global_settings.radio_targets = vec![&radio_target_match];
|
..Default::default()
|
||||||
global_settings
|
|
||||||
};
|
};
|
||||||
let initial_context = ContextElement::document_context();
|
let initial_context = ContextElement::document_context();
|
||||||
let initial_context = Context::new(&global_settings, List::new(&initial_context));
|
let initial_context = Context::new(&global_settings, List::new(&initial_context));
|
||||||
let paragraph_matcher = parser_with_context!(element(true))(&initial_context);
|
|
||||||
let (remaining, first_paragraph) = paragraph_matcher(input).expect("Parse first paragraph");
|
let (remaining, first_paragraph) =
|
||||||
|
element(true)(&initial_context, input).expect("Parse first paragraph");
|
||||||
let first_paragraph = match first_paragraph {
|
let first_paragraph = match first_paragraph {
|
||||||
Element::Paragraph(paragraph) => paragraph,
|
Element::Paragraph(paragraph) => paragraph,
|
||||||
_ => panic!("Should be a paragraph!"),
|
_ => panic!("Should be a paragraph!"),
|
||||||
|
@ -137,7 +137,7 @@ fn script_body<'b, 'g, 'r, 's>(
|
|||||||
ScriptBody::Braceless(body.into())
|
ScriptBody::Braceless(body.into())
|
||||||
}),
|
}),
|
||||||
map(parser_with_context!(script_with_braces)(context), |body| {
|
map(parser_with_context!(script_with_braces)(context), |body| {
|
||||||
ScriptBody::WithBraces(body.into())
|
ScriptBody::WithBraces(body)
|
||||||
}),
|
}),
|
||||||
map(
|
map(
|
||||||
parser_with_context!(script_with_parenthesis)(context),
|
parser_with_context!(script_with_parenthesis)(context),
|
||||||
|
Loading…
Reference in New Issue
Block a user