Apply more suggestions.
This commit is contained in:
@@ -76,10 +76,7 @@ where
|
||||
let parser_context = context.with_additional_node(&contexts[0]);
|
||||
let parser_context = parser_context.with_additional_node(&contexts[1]);
|
||||
let parser_context = parser_context.with_additional_node(&contexts[2]);
|
||||
let parameters = match parameters {
|
||||
Some((_ws, parameters)) => Some(parameters),
|
||||
None => None,
|
||||
};
|
||||
let parameters = parameters.map(|(_ws, parameters)| parameters);
|
||||
|
||||
let object_matcher = parser_with_context!(standard_set_object)(&parser_context);
|
||||
let exit_matcher = parser_with_context!(exit_matcher_parser)(&parser_context);
|
||||
@@ -110,7 +107,7 @@ where
|
||||
context.get_global_settings(),
|
||||
affiliated_keywords,
|
||||
),
|
||||
data: parameters.map(|parameters| Into::<&str>::into(parameters)),
|
||||
data: parameters.map(Into::<&str>::into),
|
||||
children,
|
||||
},
|
||||
))
|
||||
@@ -295,7 +292,7 @@ where
|
||||
affiliated_keywords,
|
||||
),
|
||||
export_type: export_type.map(Into::<&str>::into),
|
||||
data: parameters.map(|parameters| Into::<&str>::into(parameters)),
|
||||
data: parameters.map(Into::<&str>::into),
|
||||
contents,
|
||||
},
|
||||
))
|
||||
@@ -344,7 +341,7 @@ where
|
||||
let (switches, number_lines, preserve_indent, retain_labels, use_labels, label_format) = {
|
||||
if let Some(switches) = switches {
|
||||
(
|
||||
if switches.source.len() == 0 {
|
||||
if switches.source.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(switches.source)
|
||||
@@ -390,7 +387,7 @@ fn data<'s>(input: OrgSource<'s>) -> Res<OrgSource<'s>, OrgSource<'s>> {
|
||||
is_not("\r\n")(input)
|
||||
}
|
||||
|
||||
fn lesser_block_end<'c>(current_name: &'c str) -> impl ContextMatcher + 'c {
|
||||
fn lesser_block_end(current_name: &str) -> impl ContextMatcher + '_ {
|
||||
// Since the lesser block names are statically defined in code, we can simply assert that the name is lowercase instead of causing an allocation by converting to lowercase.
|
||||
debug_assert!(current_name == current_name.to_lowercase());
|
||||
move |context, input: OrgSource<'_>| _lesser_block_end(context, input, current_name)
|
||||
@@ -420,7 +417,7 @@ fn _lesser_block_end<'b, 'g, 'r, 's, 'c>(
|
||||
/// Parser for the beginning of a lesser block
|
||||
///
|
||||
/// current_name MUST be lowercase. We do not do the conversion ourselves because it is not allowed in a const fn.
|
||||
const fn lesser_block_begin<'c>(current_name: &'c str) -> impl ContextMatcher + 'c {
|
||||
const fn lesser_block_begin(current_name: &str) -> impl ContextMatcher + '_ {
|
||||
// TODO: Since this is a const fn, is there ANY way to "generate" functions at compile time?
|
||||
move |context, input: OrgSource<'_>| _lesser_block_begin(context, input, current_name)
|
||||
}
|
||||
@@ -531,11 +528,8 @@ fn _example_src_switches<'s>(
|
||||
(SwitchState::Normal, "-r") => {
|
||||
saw_r = true;
|
||||
use_labels = false;
|
||||
match retain_labels {
|
||||
RetainLabels::Yes => {
|
||||
retain_labels = RetainLabels::No;
|
||||
}
|
||||
_ => {}
|
||||
if let RetainLabels::Yes = retain_labels {
|
||||
retain_labels = RetainLabels::No;
|
||||
}
|
||||
}
|
||||
(SwitchState::Normal, "-l") => {
|
||||
@@ -675,7 +669,9 @@ pub(crate) fn content<'b, 'g, 'r, 's>(
|
||||
}
|
||||
|
||||
let (remain, (pre_escape_whitespace, line)) = content_line(remaining)?;
|
||||
pre_escape_whitespace.map(|val| ret.push_str(Into::<&str>::into(val)));
|
||||
if let Some(val) = pre_escape_whitespace {
|
||||
ret.push_str(Into::<&str>::into(val));
|
||||
}
|
||||
ret.push_str(line.into());
|
||||
remaining = remain;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user