From 18d0676fad218e99f1c50df4cdcfa6715152eb5e Mon Sep 17 00:00:00 2001 From: Tom Alexander Date: Mon, 16 Oct 2023 15:03:23 -0400 Subject: [PATCH] Clean up. --- src/parser/diary_sexp.rs | 9 +++------ src/parser/element_parser.rs | 2 +- src/parser/fixed_width_area.rs | 7 +++---- src/parser/footnote_definition.rs | 7 +++---- src/parser/plain_list.rs | 13 ++++++------- src/parser/table.rs | 7 +++---- 6 files changed, 19 insertions(+), 26 deletions(-) diff --git a/src/parser/diary_sexp.rs b/src/parser/diary_sexp.rs index eb118178..c58f0d37 100644 --- a/src/parser/diary_sexp.rs +++ b/src/parser/diary_sexp.rs @@ -1,15 +1,12 @@ use nom::bytes::complete::is_not; use nom::bytes::complete::tag; use nom::combinator::recognize; -use nom::multi::many0; use nom::sequence::tuple; use super::affiliated_keyword::parse_affiliated_keywords; -use super::keyword::affiliated_keyword; use super::org_source::OrgSource; use super::util::maybe_consume_trailing_whitespace_if_not_exiting; use super::util::org_line_ending; -use crate::context::parser_with_context; use crate::context::RefContext; use crate::error::Res; use crate::parser::util::get_consumed; @@ -52,12 +49,12 @@ where #[cfg_attr( feature = "tracing", - tracing::instrument(ret, level = "debug", skip(context, affiliated_keywords)) + tracing::instrument(ret, level = "debug", skip(_context, _affiliated_keywords)) )] pub(crate) fn detect_diary_sexp<'b, 'g, 'r, 's, AK>( - affiliated_keywords: AK, + _affiliated_keywords: AK, remaining: OrgSource<'s>, - context: RefContext<'b, 'g, 'r, 's>, + _context: RefContext<'b, 'g, 'r, 's>, input: OrgSource<'s>, ) -> Res, ()> where diff --git a/src/parser/element_parser.rs b/src/parser/element_parser.rs index c5c87a1d..4e0f3968 100644 --- a/src/parser/element_parser.rs +++ b/src/parser/element_parser.rs @@ -1,4 +1,4 @@ -use nom::branch::alt; + use nom::multi::many0; use super::babel_call::babel_call; diff --git a/src/parser/fixed_width_area.rs b/src/parser/fixed_width_area.rs index 2afae7d3..73f4d150 100644 --- a/src/parser/fixed_width_area.rs +++ b/src/parser/fixed_width_area.rs @@ -10,7 +10,6 @@ use nom::sequence::preceded; use nom::sequence::tuple; use super::affiliated_keyword::parse_affiliated_keywords; -use super::keyword::affiliated_keyword; use super::org_source::OrgSource; use super::util::maybe_consume_trailing_whitespace_if_not_exiting; use super::util::org_line_ending; @@ -91,12 +90,12 @@ fn fixed_width_area_line<'b, 'g, 'r, 's>( #[cfg_attr( feature = "tracing", - tracing::instrument(ret, level = "debug", skip(context, affiliated_keywords)) + tracing::instrument(ret, level = "debug", skip(_context, _affiliated_keywords)) )] pub(crate) fn detect_fixed_width_area<'b, 'g, 'r, 's, AK>( - affiliated_keywords: AK, + _affiliated_keywords: AK, remaining: OrgSource<'s>, - context: RefContext<'b, 'g, 'r, 's>, + _context: RefContext<'b, 'g, 'r, 's>, input: OrgSource<'s>, ) -> Res, ()> where diff --git a/src/parser/footnote_definition.rs b/src/parser/footnote_definition.rs index ea1f3c02..cc1ca891 100644 --- a/src/parser/footnote_definition.rs +++ b/src/parser/footnote_definition.rs @@ -12,7 +12,6 @@ use nom::multi::many_till; use nom::sequence::tuple; use super::affiliated_keyword::parse_affiliated_keywords; -use super::keyword::affiliated_keyword; use super::org_source::OrgSource; use super::util::include_input; use super::util::maybe_consume_trailing_whitespace_if_not_exiting; @@ -140,12 +139,12 @@ fn footnote_definition_end<'b, 'g, 'r, 's>( #[cfg_attr( feature = "tracing", - tracing::instrument(ret, level = "debug", skip(context, affiliated_keywords)) + tracing::instrument(ret, level = "debug", skip(_context, _affiliated_keywords)) )] pub(crate) fn detect_footnote_definition<'b, 'g, 'r, 's, AK>( - affiliated_keywords: AK, + _affiliated_keywords: AK, remaining: OrgSource<'s>, - context: RefContext<'b, 'g, 'r, 's>, + _context: RefContext<'b, 'g, 'r, 's>, input: OrgSource<'s>, ) -> Res, ()> where diff --git a/src/parser/plain_list.rs b/src/parser/plain_list.rs index f8d5ec82..0025eeb8 100644 --- a/src/parser/plain_list.rs +++ b/src/parser/plain_list.rs @@ -20,7 +20,6 @@ use nom::sequence::tuple; use super::affiliated_keyword::parse_affiliated_keywords; use super::element_parser::element; -use super::keyword::affiliated_keyword; use super::object_parser::standard_set_object; use super::org_source::OrgSource; use super::util::include_input; @@ -53,10 +52,10 @@ use crate::types::PlainListType; #[cfg_attr( feature = "tracing", - tracing::instrument(ret, level = "debug", skip(context, affiliated_keywords)) + tracing::instrument(ret, level = "debug", skip(context, _affiliated_keywords)) )] pub(crate) fn detect_plain_list<'b, 'g, 'r, 's, AK>( - affiliated_keywords: AK, + _affiliated_keywords: AK, remaining: OrgSource<'s>, context: RefContext<'b, 'g, 'r, 's>, input: OrgSource<'s>, @@ -734,7 +733,7 @@ dolar"#, let global_settings = GlobalSettings::default(); let initial_context = ContextElement::document_context(); let initial_context = Context::new(&global_settings, List::new(&initial_context)); - let result = detect_plain_list(&initial_context, input); + let result = detect_plain_list(std::iter::empty(), input, &initial_context, input); assert!(result.is_ok()); } @@ -744,7 +743,7 @@ dolar"#, let global_settings = GlobalSettings::default(); let initial_context = ContextElement::document_context(); let initial_context = Context::new(&global_settings, List::new(&initial_context)); - let result = detect_plain_list(&initial_context, input); + let result = detect_plain_list(std::iter::empty(), input, &initial_context, input); assert!(result.is_ok()); } @@ -754,7 +753,7 @@ dolar"#, let global_settings = GlobalSettings::default(); let initial_context = ContextElement::document_context(); let initial_context = Context::new(&global_settings, List::new(&initial_context)); - let result = detect_plain_list(&initial_context, input); + let result = detect_plain_list(std::iter::empty(), input, &initial_context, input); // Since there is no whitespace after the '+' this is a paragraph, not a plain list. assert!(result.is_err()); } @@ -765,7 +764,7 @@ dolar"#, let global_settings = GlobalSettings::default(); let initial_context = ContextElement::document_context(); let initial_context = Context::new(&global_settings, List::new(&initial_context)); - let result = detect_plain_list(&initial_context, input); + let result = detect_plain_list(std::iter::empty(), input, &initial_context, input); assert!(result.is_ok()); } } diff --git a/src/parser/table.rs b/src/parser/table.rs index 934a30cf..e1079dbb 100644 --- a/src/parser/table.rs +++ b/src/parser/table.rs @@ -14,7 +14,6 @@ use nom::multi::many_till; use nom::sequence::tuple; use super::affiliated_keyword::parse_affiliated_keywords; -use super::keyword::affiliated_keyword; use super::keyword::table_formula_keyword; use super::object_parser::table_cell_set_object; use super::org_source::OrgSource; @@ -94,12 +93,12 @@ where #[cfg_attr( feature = "tracing", - tracing::instrument(ret, level = "debug", skip(context, affiliated_keywords)) + tracing::instrument(ret, level = "debug", skip(_context, _affiliated_keywords)) )] pub(crate) fn detect_table<'b, 'g, 'r, 's, AK>( - affiliated_keywords: AK, + _affiliated_keywords: AK, remaining: OrgSource<'s>, - context: RefContext<'b, 'g, 'r, 's>, + _context: RefContext<'b, 'g, 'r, 's>, input: OrgSource<'s>, ) -> Res, ()> where