Fix clippy issues.
All checks were successful
rust-test Build rust-test has succeeded
rust-clippy Build rust-clippy has succeeded
build-natter Build build-natter has succeeded
format Build format has succeeded

This commit is contained in:
Tom Alexander
2023-12-23 06:38:23 -05:00
parent 818fca87f2
commit 397d4ea0bc
20 changed files with 42 additions and 73 deletions

View File

@@ -52,9 +52,9 @@ impl<'orig, 'parse> Registry<'orig, 'parse> {
pub(crate) async fn get_footnote_reference_id<'orig, 'parse>(
intermediate_context: IntermediateContext<'orig, 'parse>,
label: Option<&'parse str>,
definition: &'orig Vec<Object<'parse>>,
definition: &'orig [Object<'parse>],
) -> Result<(usize, usize), CustomError> {
if let None = label {
if label.is_none() {
// If it has no label then it must always get a new ID.
let contents = convert_reference_contents(intermediate_context.clone(), definition).await?;
let pos = {
@@ -148,7 +148,7 @@ pub(crate) async fn register_footnote_definition<'orig, 'parse>(
async fn convert_reference_contents<'orig, 'parse>(
intermediate_context: IntermediateContext<'orig, 'parse>,
contents: &'orig Vec<Object<'parse>>,
contents: &'orig [Object<'parse>],
) -> Result<Vec<IAstNode>, CustomError> {
let children = {
let mut ret = Vec::new();
@@ -159,23 +159,19 @@ async fn convert_reference_contents<'orig, 'parse>(
};
let containing_paragraph =
IParagraph::artificial(intermediate_context.clone(), children, 0).await?;
let contents = {
let mut ret = Vec::new();
ret.push(IAstNode::Paragraph(containing_paragraph));
ret
};
let contents = vec![IAstNode::Paragraph(containing_paragraph)];
Ok(contents)
}
async fn convert_definition_contents<'orig, 'parse>(
intermediate_context: IntermediateContext<'orig, 'parse>,
contents: &'orig Vec<Element<'parse>>,
contents: &'orig [Element<'parse>],
) -> Result<Vec<IAstNode>, CustomError> {
let contents = {
let mut ret = Vec::new();
for obj in contents.iter() {
ret.push(obj.into_ast_node(intermediate_context.clone()).await?);
ret.push(obj.as_ast_node(intermediate_context.clone()).await?);
}
ret
};
@@ -190,8 +186,7 @@ pub(crate) async fn promote_footnote_definition<'orig, 'parse>(
) -> Result<(), CustomError> {
let definition = {
let mut registry = intermediate_context.registry.lock().unwrap();
let definition = registry.on_deck_footnote_ids.remove(label);
definition
registry.on_deck_footnote_ids.remove(label)
};
if let Some(elements) = definition {
let existing_id = {